Skip to content

Commit

Permalink
Merge pull request #5297 from sellout/impossible-in-lexer
Browse files Browse the repository at this point in the history
Turn a possible “impossible” into a parse failure
  • Loading branch information
pchiusano authored Aug 23, 2024
2 parents 7178ec2 + a025454 commit 1207653
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion unison-syntax/src/Unison/Syntax/Lexer/Unison.hs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ token'' tok p = do
else
if column p < top l
then S.put (env {layout = pop l}) >> ((Token Close p p :) <$> pops p)
else error "impossible"
else -- we hit this branch exactly when `token''` is given the state
-- `{layout = [], opening = Nothing, inLayout = True}`
fail "internal error: token''"

-- don't emit virtual semis in (, {, or [ blocks
topContainsVirtualSemis :: Layout -> Bool
Expand Down

0 comments on commit 1207653

Please sign in to comment.