fix: add term elaborator for Lean.Parser.Term.namedPattern (#4792)
closes #4662
This commit is contained in:
parent
204d4839fa
commit
5c3360200e
2 changed files with 18 additions and 0 deletions
|
|
@ -362,4 +362,7 @@ private opaque evalFilePath (stx : Syntax) : TermElabM System.FilePath
|
|||
mkStrLit <$> IO.FS.readFile path
|
||||
| _, _ => throwUnsupportedSyntax
|
||||
|
||||
@[builtin_term_elab Lean.Parser.Term.namedPattern] def elabNamedPatternErr : TermElab := fun stx _ =>
|
||||
throwError "`<identifier>@<term>` is a named pattern and can only be used in pattern matching contexts{indentD stx}"
|
||||
|
||||
end Lean.Elab.Term
|
||||
|
|
|
|||
15
tests/lean/run/4662.lean
Normal file
15
tests/lean/run/4662.lean
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/--
|
||||
error: `<identifier>@<term>` is a named pattern and can only be used in pattern matching contexts
|
||||
p@()
|
||||
-/
|
||||
#guard_msgs in
|
||||
def minimal : Unit -> Unit := by
|
||||
intro i
|
||||
let k:p@() := i
|
||||
sorry
|
||||
|
||||
def minimal2 : Unit -> Unit := by
|
||||
intro i
|
||||
let p@k:() := i
|
||||
guard_hyp k : p = ()
|
||||
exact ()
|
||||
Loading…
Add table
Reference in a new issue