feat: elaborate double quoted named literals

This commit is contained in:
Leonardo de Moura 2020-12-09 17:35:16 -08:00
parent 0af806fb49
commit ec1e6a68fa

View file

@ -1290,12 +1290,16 @@ def elabScientificLit : TermElab := fun stx expectedType? => do
| some val => return mkApp (Lean.mkConst `Char.ofNat) (mkNatLit val.toNat)
| none => throwIllFormedSyntax
@[builtinTermElab quotedName] def elabQuotedName : TermElab :=
fun stx _ =>
@[builtinTermElab quotedName] def elabQuotedName : TermElab := fun stx _ =>
match stx[0].isNameLit? with
| some val => pure $ toExpr val
| none => throwIllFormedSyntax
@[builtinTermElab doubleQuotedName] def elabDoubleQuotedName : TermElab := fun stx _ => do
match stx[1].isNameLit? with
| some val => toExpr (← resolveGlobalConstNoOverload val)
| none => throwIllFormedSyntax
@[builtinTermElab typeOf] def elabTypeOf : TermElab := fun stx _ => do
inferType (← elabTerm stx[1] none)