chore: update stage0
This commit is contained in:
parent
8735820b49
commit
34cddb334e
2 changed files with 411 additions and 657 deletions
15
stage0/src/Lean/Elab/BuiltinNotation.lean
generated
15
stage0/src/Lean/Elab/BuiltinNotation.lean
generated
|
|
@ -36,14 +36,15 @@ fun stx expectedType? => match_syntax stx with
|
|||
tryPostponeIfNoneOrMVar expectedType?
|
||||
match expectedType? with
|
||||
| some expectedType =>
|
||||
let expectedType ← instantiateMVars expectedType
|
||||
let expectedType := expectedType.consumeMData
|
||||
let expectedType ← whnf expectedType
|
||||
matchConstStruct expectedType.getAppFn
|
||||
(fun _ => throwError! "invalid constructor ⟨...⟩, expected type must be a structure {indentExpr expectedType}")
|
||||
(fun val _ ctor => do
|
||||
let newStx ← `($(mkCIdentFrom stx ctor.name) $(args.getSepElems)*)
|
||||
withMacroExpansion stx newStx $ elabTerm newStx expectedType?)
|
||||
matchConstInduct expectedType.getAppFn
|
||||
(fun _ => throwError! "invalid constructor ⟨...⟩, expected type must be an inductive type {indentExpr expectedType}")
|
||||
(fun ival us => do
|
||||
match ival.ctors with
|
||||
| [ctor] =>
|
||||
let newStx ← `($(mkCIdentFrom stx ctor) $(args.getSepElems)*)
|
||||
withMacroExpansion stx newStx $ elabTerm newStx expectedType?
|
||||
| _ => throwError! "invalid constructor ⟨...⟩, expected type must be an inductive type with only one constructor {indentExpr expectedType}")
|
||||
| none => throwError "invalid constructor ⟨...⟩, expected type must be known"
|
||||
| _ => throwUnsupportedSyntax
|
||||
|
||||
|
|
|
|||
1053
stage0/stdlib/Lean/Elab/BuiltinNotation.c
generated
1053
stage0/stdlib/Lean/Elab/BuiltinNotation.c
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue