Don't recurse without bound in outerPath#7178
Merged
lrytz merged 1 commit intoscala:2.13.xfrom Oct 1, 2018
Merged
Conversation
som-snytt
reviewed
Sep 5, 2018
| else { | ||
| val outerSel = outerSelect(base) | ||
| if(outerSel == EmptyTree) EmptyTree | ||
| else outerPath(outerSelect(base), from.outerClass, to) |
Contributor
There was a problem hiding this comment.
Probably intended to use outerSel again. Also, space after if! Ahh! if is not a function call!
Contributor
Author
There was a problem hiding this comment.
Oh good grief ... inexcusable.
Contributor
|
The PR title is very Zen. |
som-snytt
approved these changes
Sep 5, 2018
Contributor
som-snytt
left a comment
There was a problem hiding this comment.
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 |
Contributor
There was a problem hiding this comment.
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
Contributor
Author
|
Used |
ivanopagano
added a commit
to ivanopagano/scala
that referenced
this pull request
Jul 16, 2020
* copy the bugfix for scala/bug#10035 to the 2.12.x branch, as-is
ivanopagano
added a commit
to ivanopagano/scala
that referenced
this pull request
Jul 17, 2020
* copy the bugfix for scala/bug#10035 to the 2.12.x branch, as-is
ivanopagano
added a commit
to ivanopagano/scala
that referenced
this pull request
Jul 17, 2020
* copy the bugfix for scala/bug#10035 to the 2.12.x branch, as-is
dwijnand
added a commit
to dwijnand/scala
that referenced
this pull request
Sep 14, 2020
* 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
hamzaremmal
pushed a commit
to hamzaremmal/scala3
that referenced
this pull request
May 2, 2025
* 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
hamzaremmal
pushed a commit
to scala/scala3
that referenced
this pull request
May 7, 2025
* 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.