fix: error recovery at sepBy combinator

This commit is contained in:
Leonardo de Moura 2021-04-05 14:17:30 -07:00
parent 474ee644d7
commit f13bdd6869
3 changed files with 19 additions and 1 deletions

View file

@ -628,7 +628,7 @@ private partial def sepByFnAux (p : ParserFn) (sep : ParserFn) (allowTrailingSep
let mut s := p c s
if s.hasError then
if s.pos > pos then
return s
return s.mkNode nullKind iniSz
else if pOpt then
let s := s.restore sz pos
return s.mkNode nullKind iniSz

View file

@ -0,0 +1,10 @@
structure S where
x : Nat
y : String
b : Bool
def f (s : S) : Nat :=
let rec foo (s : S) :=
if s. then 1 else 2
--^ textDocument/completion
foo s

View file

@ -0,0 +1,8 @@
{"textDocument": {"uri": "file://completion3.lean"},
"position": {"line": 7, "character": 9}}
{"items":
[{"label": "b", "detail": "S → Bool"},
{"label": "mk", "detail": "Nat → String → Bool → S"},
{"label": "x", "detail": "S → Nat"},
{"label": "y", "detail": "S → String"}],
"isIncomplete": true}