-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Consider hiding the distinction between Select & Ident #1686
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
@DarkDimius you mean we add a transform to convert If you mean replace |
as new trees can be introduced by any phase after the transform would break this inveriant, it's not what I propose.
Neither do I propose to change parser. The current situation is that distinction between Eg given a source: package bar;
class Foo {
val s = 1
}
// somewhere in method
val f = new Foo
import f._
f.s
s
@liufengyun, I propose to consider options below:
NB:
this might also be a bad idea from performance point of view. Idents and Selects are very common node types. If anything, I'd actually prefer to convert as many Selects to Idents as possible to reduce the footprint of the tree. |
I think the problem is that if the type of a qualifier is a path, we have a tendency to leave it as an Ident. And this is indeed important for performance. Otherwise, think about all the Selects we would create when we select a global symbol in some object in some nested package... But if the type if a ref is not a path then we lose information. E.g. if Not sure what's a good way to generalize this, and which does not involve converting almost everything to a Select. |
That is, if If you don't want even one wrapper, what about distinguishing (after the appropriate phase)
Couldn't the invariant be tested and enforced, and the later phases be adapted? Of course changing all the existing references is lots of work. |
Uh oh!
There was an error while loading. Please reload this page.
In Dotty, Select & Idents are very interchangeable and the only reliable way to see if this is a selection or a direct reference is to look at the type.
Correct handling of them is counterintuitive, as one would assume he could trust the tree, but he cant: https://github.com/lampepfl/dotty/blob/master/src/dotty/tools/backend/jvm/DottyBackendInterface.scala#L428-L438
This introduces misconceptions such as the one happened at #1685
Note that we already have a tree type that should be used instead: RefTree.
The text was updated successfully, but these errors were encountered: