Skip to content

Commit 8808029

Browse files
authored
Fix the issue (#14334)
The problem was that we had some cached lexer state when reading new input during FSI session. If lexer threw an error on a very first token of new input, the cached lexer state would not get updated, so we would assosciate old lexer state with this new token that caused an error. Now we will invalidate that cached state at the begining of reading new input. Co-authored-by: Adam Boniecki <[email protected]>
1 parent df5f7bb commit 8808029

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Compiler/SyntaxTree/LexFilter.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,8 @@ type LexFilterImpl (
699699
let mutable prevWasAtomicEnd = false
700700

701701
let peekInitial() =
702+
// Forget the lexbuf state we might have saved from previous input
703+
haveLexbufState <- false
702704
let initialLookaheadTokenTup = popNextTokenTup()
703705
if debug then dprintf "first token: initialLookaheadTokenLexbufState = %a\n" outputPos (startPosOfTokenTup initialLookaheadTokenTup)
704706

0 commit comments

Comments
 (0)