Skip to content

Fix #1442: add new phase, SelectStatic #1445

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

Merged
merged 9 commits into from
Aug 15, 2016

Conversation

DarkDimius
Copy link
Contributor

@DarkDimius DarkDimius commented Aug 9, 2016

GenBCode has an implicit assumption that I wasn't aware of:
GetStatic should not be emitted against a non-trivial selector.
If it is, GenBCode messes up the stack by not pop-ing the selector.

Surprisingly, this transformation is perfumed in nsc by flatten.

GenBCode has an implicit assumption that I wasn't aware of:
  GetStatic should not be emitted against a valid selector.
If it is, GenBCode messes up the stack by not pop-ing the selector.

Surprisingly, this transformation is perfumed in nsc by flatten.
@DarkDimius DarkDimius changed the title Fix #1442: add new phase, SelectStatic GenBCode has an implicit assumption that I wasn't aware of: GetStatic should not be emitted against a valid selector. If it is, GenBCode messes up the stack by not pop-ing the selector. Fix #1442: add new phase, SelectStatic Aug 9, 2016
Blocks are not denoting trees(why aren't they?)
For now, I'm fixing this using a quick fix.
For future, it may make sense to discuss this on dotty meeting and
make blocks be a Denoting tree and return denotation of expo.

Another option is to move regularisation logic into tree transformers.
The new behaviour is more reasonable.
Now the module if forced consistently in both examples.

Note that this is deviation from behaviour of scalac.
case Select(Block(stats, qual), nm) =>
Block(stats, cpy.Select(t)(qual, nm))
case Apply(Block(stats, qual), nm) =>
Block(stats, Apply(qual, nm))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason not to copy Apply and TypeApplyas you do with Select?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copying does not copy the tree here, as it always has a different structure.
cpy.Select can preserve the symbol though, in case method is overloaded. This is not needed for Apply\TypeApply as by the time they are applied overloads are already resolved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I asked because I ran into the overloading issues some time ago. Great!

@jvican
Copy link
Member

jvican commented Aug 9, 2016

LGTM, thanks for the quick and elegant fix @DarkDimius!

@DarkDimius DarkDimius merged commit a7fab6d into scala:master Aug 15, 2016
@sirinath
Copy link

A general comment. Try to keep the rest loosely coupled with the backend so they can evolve independently and cages in one area does not necessitate changes elsewhere.

@allanrenucci allanrenucci deleted the fix-#1442 branch December 14, 2017 16:59
sjrd added a commit to dotty-staging/dotty that referenced this pull request Sep 14, 2020
… objects.

This restores parity with the run-time semantics of Scala 2. When
accessing an inner static class or object, we avoid loading the
enclosing objects as values.

The discrepancy in run-time semantics was introduced as a
by-product of scala#1445
The change in `t4859.check` restores it to its previous state,
before that PR.
sjrd added a commit to dotty-staging/dotty that referenced this pull request Sep 14, 2020
… objects.

This restores parity with the run-time semantics of Scala 2. When
accessing an inner static class or object, we avoid loading the
enclosing objects as values.

The discrepancy in run-time semantics was introduced as a
by-product of scala#1445
The change in `t4859.check` restores it to its previous state,
before that PR.
sjrd added a commit to dotty-staging/dotty that referenced this pull request Sep 15, 2020
… objects.

This restores parity with the run-time semantics of Scala 2. When
accessing an inner static class or object, we avoid loading the
enclosing objects as values.

The discrepancy in run-time semantics was introduced as a
by-product of scala#1445
The change in `t4859.check` restores it to its previous state,
before that PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants