fix: error recovery at sepBy combinator
This commit is contained in:
parent
474ee644d7
commit
f13bdd6869
3 changed files with 19 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
10
tests/lean/interactive/completion3.lean
Normal file
10
tests/lean/interactive/completion3.lean
Normal 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
|
||||
8
tests/lean/interactive/completion3.lean.expected.out
Normal file
8
tests/lean/interactive/completion3.lean.expected.out
Normal 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}
|
||||
Loading…
Add table
Reference in a new issue