feat: add array literal notation
This commit is contained in:
parent
76e75a1b53
commit
eb24ec56dc
2 changed files with 9 additions and 0 deletions
|
|
@ -723,6 +723,14 @@ fun stx expectedType? => do
|
|||
let newStx := args.foldSepRevArgs (fun arg r => mkAppStx consId #[arg, r]) nilId;
|
||||
elabTerm newStx expectedType?
|
||||
|
||||
@[builtinTermElab «arrayLit»] def elabArrayLit : TermElab :=
|
||||
fun stx expectedType? => do
|
||||
match_syntax stx.val with
|
||||
| `(#[$args*]) => do
|
||||
newStx ← `(List.toArray [$args*]);
|
||||
withMacroExpansion stx.val (elabTerm newStx expectedType?)
|
||||
| _ => throwError stx.val "unexpected array literal syntax"
|
||||
|
||||
def elabExplicitUniv (stx : Syntax) : TermElabM (List Level) :=
|
||||
pure [] -- TODO
|
||||
|
||||
|
|
|
|||
|
|
@ -150,3 +150,4 @@ f a
|
|||
|
||||
#eval run "#check fun x => foo x x.w s4"
|
||||
#eval run "#check bla (fun x => x.w) s4"
|
||||
#eval run "#check #[1, 2, 3]"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue