fix: auto/option params should not break sorry (#4132)

closes #2649
This commit is contained in:
Leonardo de Moura 2024-05-11 04:10:40 +02:00 committed by GitHub
parent 147aeaea45
commit 7db8e6482e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -205,7 +205,7 @@ private def elabTParserMacroAux (prec lhsPrec e : Term) : TermElabM Syntax := do
| _ => Macro.throwUnsupported
@[builtin_term_elab «sorry»] def elabSorry : TermElab := fun stx expectedType? => do
let stxNew ← `(sorryAx _ false)
let stxNew ← `(@sorryAx _ false) -- Remark: we use `@` to ensure `sorryAx` will not consume auot params
withMacroExpansion stx stxNew <| elabTerm stxNew expectedType?
/-- Return syntax `Prod.mk elems[0] (Prod.mk elems[1] ... (Prod.mk elems[elems.size - 2] elems[elems.size - 1])))` -/

3
tests/lean/run/2649.lean Normal file
View file

@ -0,0 +1,3 @@
def foo1 : (_ : Nat := 0) → Nat := sorry
def foo2 : (_ : Nat := by exact 0) → Nat := sorry