chore: elaborate let_core

This commit is contained in:
Leonardo de Moura 2020-01-25 15:21:47 -08:00
parent 2ae231cc65
commit 993ae96fb7
2 changed files with 8 additions and 0 deletions

View file

@ -291,6 +291,12 @@ withLetDecl ref n type val $ fun x => do
body ← instantiateMVars ref body;
mkLet ref x body
@[builtinTermElab «let_core»] def elabLetCore : TermElab :=
fun stx expectedType? => match_syntax stx with
| `(let_core $id:ident := $val; $body) =>
elabLetDeclAux stx id.getId #[] (mkHole stx) val body expectedType?
| _ => throwUnsupportedSyntax
def elabLetIdDecl (ref : Syntax) (decl body : Syntax) (expectedType? : Option Expr) : TermElabM Expr :=
-- `decl` is of the form: ident bracktedBinder+ (`:` term)? `:=` term
let n := decl.getIdAt 0;

View file

@ -11,3 +11,5 @@ macro_rules
| `(case! $h : $cond with $t, $e) => `((fun $h => cond $h $t $e) $cond)
#check case! h : 0 == 0 with h, not h
#check let_core x := 1+2; x+x