Skip to content

Commit

Permalink
Fix the issue (#14334)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
abonie and abonie authored Nov 18, 2022
1 parent df5f7bb commit 8808029
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Compiler/SyntaxTree/LexFilter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ type LexFilterImpl (
let mutable prevWasAtomicEnd = false

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

Expand Down

0 comments on commit 8808029

Please sign in to comment.