-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Stack overflow in LabelDef phase when pattern matching on many complex cases #2903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 28, 2017
* Extract all match arguments before checking conditions on them like scalac does. This avoids an extra nested block for each match variable. * Merge conditions of nested `if` expressions if their `else` branch is the same. This optimization combined with the previous removes most of the nested `if`s created to check the matched args.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 28, 2017
* Extract all match arguments before checking conditions on them like scalac does. This avoids an extra nested block for each match variable. * Merge conditions of nested `if` expressions if their `else` branch is the same. This optimization combined with the previous removes most of the nested `if`s created to check the matched args.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 29, 2017
* Extract all match arguments before checking conditions on them like scalac does. This avoids an extra nested block for each match variable. * Merge conditions of nested `if` expressions if their `else` branch is the same. This optimization combined with the previous removes most of the nested `if`s created to check the matched args.
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 29, 2017
* Extract all match arguments before checking conditions on them like scalac does. This avoids an extra nested block for each match variable. * Merge conditions of nested `if` expressions if their `else` branch is the same. This optimization combined with the previous removes most of the nested `if`s created to check the matched args.
odersky
added a commit
that referenced
this issue
Dec 23, 2017
Fix #2903: Reduce the depth of trees generated in PatternMatcher
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
This code compiles fine with Scala 2.11 and 2.12 but stack overflows in Dotty (both with the old and new patmat, even with
-optimise
):By commenting out 4 cases you can make it go a bit further and only die with a stack overflow in
GenBCode
.The corresponding real world code I'm looking at is https://github.com/epfl-lara/stainless/blob/bf0ef122f4d3b3c9a852425e4db9ca55941398bc/frontends/dotty/src/main/scala/stainless/frontends/dotc/CodeExtraction.scala#L674-L1205
The text was updated successfully, but these errors were encountered: