-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Don't recurse without bound in outerPath #7178
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
Conversation
| else { | ||
| val outerSel = outerSelect(base) | ||
| if(outerSel == EmptyTree) EmptyTree | ||
| else outerPath(outerSelect(base), from.outerClass, to) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably intended to use outerSel again. Also, space after if! Ahh! if is not a function call!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good grief ... inexcusable.
|
The PR title is very Zen. |
som-snytt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, it works! One style nit. I hesitate to call it that, because Miles is a style icon. I guess in the sense of lifestyle icon.
| else outerPath(outerSelect(base), from.outerClass, to) | ||
| else { | ||
| val outerSel = outerSelect(base) | ||
| if (outerSel == EmptyTree) EmptyTree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (outerSel.isEmpty) is idiomatic, it turns out.
outerSelect returns EmptyTree if it hits a Symbol with no outer accessor. outerPath doesn't check for this and will happily hand the returned EmptyTree back to outerSelect, and so on until stack overflow. The fix is to check for an EmptyTree result and terminate. Fixes scala#10035.
bb6c968 to
37ec8dd
Compare
|
Used |
* copy the bugfix for scala/bug#10035 to the 2.12.x branch, as-is
* copy the bugfix for scala/bug#10035 to the 2.12.x branch, as-is
* copy the bugfix for scala/bug#10035 to the 2.12.x branch, as-is
* commit 'e32b224ee1': Emit method reference lambdas without helper method Add same changes from the PR scala#7178 [backport] Exchange stack for Stack in assertNotReachable [backport] Avoid race in test for firstCompletedOf Remove exploratory assertions Stabilize order of synthetic modules in enclosing class decls Bump to Scala 2.12.12 [backport] bring AssertUtil fixes to 2.12 Add a comment to HashMap.castToThat [nomerge] small cleanups [backport] Disable all reusable instances in runtime reflection [backport] Rework recent, buggy change to immutable.TreeMap
* commit 'e32b224ee1': Emit method reference lambdas without helper method Add same changes from the PR scala/scala#7178 [backport] Exchange stack for Stack in assertNotReachable [backport] Avoid race in test for firstCompletedOf Remove exploratory assertions Stabilize order of synthetic modules in enclosing class decls Bump to Scala 2.12.12 [backport] bring AssertUtil fixes to 2.12 Add a comment to HashMap.castToThat [nomerge] small cleanups [backport] Disable all reusable instances in runtime reflection [backport] Rework recent, buggy change to immutable.TreeMap
* commit 'e32b224ee1': Emit method reference lambdas without helper method Add same changes from the PR scala/scala#7178 [backport] Exchange stack for Stack in assertNotReachable [backport] Avoid race in test for firstCompletedOf Remove exploratory assertions Stabilize order of synthetic modules in enclosing class decls Bump to Scala 2.12.12 [backport] bring AssertUtil fixes to 2.12 Add a comment to HashMap.castToThat [nomerge] small cleanups [backport] Disable all reusable instances in runtime reflection [backport] Rework recent, buggy change to immutable.TreeMap
outerSelectreturnsEmptyTreeif it hits aSymbolwith no outer accessor.outerPathdoesn't check for this and will happily hand the returnedEmptyTreeback to outerSelect, and so on until stack overflow.The fix is to check for an
EmptyTreeresult and terminate.Fixes scala/bug#10035.