-
Notifications
You must be signed in to change notification settings - Fork 38
parser crashes on polymorphic variant type #540
Conversation
@Sehun0819 thanks for reporting this! Separately, I'd like to investigate how that did get past the infinite loop analysis. |
Looks like the scanner keeps on returning Eof forever if you keep on calling it, violating one of the assumptions of termination analysis. |
Can you write the loop through parseRegion? |
Parsing past Eof can lead to infinite loops, as it violates the assumptions of the termination checker. See: #540 This PR makes `Parser.next` assert false when called on Eof. This should not happen as one should check the token before calling `Parser.next`. The one exception is during lookahead, for which we provide a `nextUnsafe` function which does not make progress.
@cristianoc I added a new commit. |
Yes thanks for that. |
There's still:
to take care of. Then I can merge. |
|
You mean,
something like above? 2 questions come to mind,
It would be possible to make things work somehow, but using workaround seems not a good answer for you. |
Yes that's the idea, which I'm quoting from @IwanKaramazow . |
For 1, the closure would return |
I tried to replace Instead, I reorganized pattern matching priority so that the recursive call to |
@Sehun0819 I've expanded the parseRegion case here: #545 |
Feel free to incorporate here and we can merge. |
Thank you! |
Parsing past Eof can lead to infinite loops, as it violates the assumptions of the termination checker. See: #540 This PR makes `Parser.next` assert false when called on Eof. This should not happen as one should check the token before calling `Parser.next`. The one exception is during lookahead, for which we provide a `nextUnsafe` function which does not make progress.
Parsing past Eof can lead to infinite loops, as it violates the assumptions of the termination checker. See: #540 This PR makes `Parser.next` assert false when called on Eof. This should not happen as one should check the token before calling `Parser.next`. The one exception is during lookahead, for which we provide a `nextUnsafe` function which does not make progress.
type x = [<y>
Parser crashes with stackoverflow on incomplete polymorphic variant type like above.
Because the closure
loop
is recursively called in wildcard case,Eof
can't escape.