feat: elaborate $.
This commit is contained in:
parent
edb1ffadb4
commit
8d81e89e53
2 changed files with 11 additions and 0 deletions
|
|
@ -17,6 +17,16 @@ fun stx expectedType? => do
|
|||
let a := stx.getArg 2;
|
||||
elabTerm (mkAppStx f #[a]) expectedType?
|
||||
|
||||
def mkProjStx (t : Syntax) (i : Syntax) : Syntax :=
|
||||
Syntax.node `Lean.Parser.Term.proj #[t, mkAtom("."), i]
|
||||
|
||||
@[builtinTermElab dollarProj] def elabDollarProj : TermElab :=
|
||||
fun stx expectedType? => do
|
||||
-- term `$.` field
|
||||
let f := stx.getArg 0;
|
||||
let i := stx.getArg 2;
|
||||
elabTerm (mkProjStx f i) expectedType?
|
||||
|
||||
def elabInfix (f : Syntax) : TermElab :=
|
||||
fun stx expectedType? => do
|
||||
-- term `op` term
|
||||
|
|
|
|||
|
|
@ -154,3 +154,4 @@ f a
|
|||
#eval run "#check #[1, 2, 3].foldl (fun r a => r.push a) #[]"
|
||||
#eval run "#check #[1, 2, 3].foldl (fun r a => (r.push a).push a) #[]"
|
||||
#eval run "#check #[1, 2, 3].foldl (fun r a => ((r.push a).push a).push a) #[]"
|
||||
#eval run "#check #[].push one $.push two $.push zero $.size.succ"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue