-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
SI-9473 Cleaner references to statically owned symbols #4749
Conversation
Review by @lrytz I tried an followup commit that uses more concise trees, so a reference to This broke some assumptions about trees in some tests, so I didn't pursue it further. |
3b290b9
to
cabb906
Compare
the test output suggests that a qualifying package is now missing - i think it should still be there:
|
cabb906
to
2ee358b
Compare
Pushed updated checkfiles. |
2ee358b
to
3bd78eb
Compare
Pushed updated checkfiles, for real this time. |
Ever wonder why `identity("")` typechecks to `scala.this.Predef.identity("")`? It turns out that `mkAttributedRef` was importing `q"$scalaPackageClass.this.Predef._"` for all these years, rather than `q"$scalaModule.Predef._"`. This commit makes `mkAttributedRef` special case static owners by referring the the corresponding module, instead.
3bd78eb
to
e265373
Compare
LGTM |
SI-9473 Cleaner references to statically owned symbols
…f[T] trees. The scala/scala PR scala/scala#4749 changed the shape of the spurious `Predef.classOf[T]` that reach the `jsinterop` phase. Previously they looked like `scala.this.Predef.classOf[T]`, where as now they are `scala.Predef.classOf[T]`. This commit generalizes the shapes of trees we recognize, so that both patterns are matched.
…f[T] trees. The scala/scala PR scala/scala#4749 changed the shape of the spurious `Predef.classOf[T]` that reach the `jsinterop` phase. Previously they looked like `scala.this.Predef.classOf[T]`, where as now they are `scala.Predef.classOf[T]`. This commit generalizes the shapes of trees we recognize, so that both patterns are matched.
It was caused by this PR: scala/scala#4749 #SCL-9457 Fixed
It was caused by this PR: scala/scala#4749 #SCL-9457 Fixed
The new unit test shows failures in transitivity of subtyping and type equivalence, which boil down the the inconsistent handling of the semantically equivalent: ThisType(pre, ModuleClass) ModuleTypeRef(pre, ModuleClass) SingleType(pre, Module) This commit: - adds a case to `normalizePlus` to unwrap a `ThisType` to a `ModuleTypeRef` - Use `normalizePlus` more widely during subtype comparison - refactor `fourthTry` (part of `isSubType`) to remove code that becomes obviated by the use of `normalizePlus`. This fixes the regression in the extension methods phase which was triggered by scala#4749. We can also fix that regression by tweaking the extension methods phase itself to emit the `ThisType` representation of the owner of the value class, as before. I plan to demonstrate the two approaches to fixing the regression on separate branches, and the propose that the merged result of these two is useds.
…f[T] trees. The scala/scala PR scala/scala#4749 changed the shape of the spurious `Predef.classOf[T]` that reach the `jsinterop` phase. Previously they looked like `scala.this.Predef.classOf[T]`, where as now they are `scala.Predef.classOf[T]`. This commit generalizes the shapes of trees we recognize, so that both patterns are matched. (cherry picked from commit eefb50a)
The new unit test shows failures in transitivity of subtyping and type equivalence, which boil down the the inconsistent handling of the semantically equivalent: ThisType(pre, ModuleClass) ModuleTypeRef(pre, ModuleClass) SingleType(pre, Module) This commit: - adds a case to `normalizePlus` to unwrap a `ThisType` to a `ModuleTypeRef` - Use `normalizePlus` more widely during subtype comparison - refactor `fourthTry` (part of `isSubType`) to remove code that becomes obviated by the use of `normalizePlus`. This fixes the regression in the extension methods phase which was triggered by scala#4749. We can also fix that regression by tweaking the extension methods phase itself to emit the `ThisType` representation of the owner of the value class, as before. I plan to demonstrate the two approaches to fixing the regression on separate branches, and the propose that the merged result of these two is useds.
The new unit test shows failures in transitivity of subtyping and type equivalence, which boil down the the inconsistent handling of the semantically equivalent: ThisType(pre, ModuleClass) ModuleTypeRef(pre, ModuleClass) SingleType(pre, Module) This commit: - adds a case to `normalizePlus` to unwrap a `ThisType` to a `ModuleTypeRef` - Use `normalizePlus` more widely during subtype comparison - refactor `fourthTry` (part of `isSubType`) to remove code that becomes obviated by the use of `normalizePlus`. This fixes the regression in the extension methods phase which was triggered by scala#4749. We can also fix that regression by tweaking the extension methods phase itself to emit the `ThisType` representation of the owner of the value class, as before. I plan to demonstrate the two approaches to fixing the regression on separate branches, and the propose that the merged result of these two is useds.
Ever wonder why
identity("")
typechecks toscala.this.Predef.identity("")
?It turns out that
mkAttributedRef
was importingq"$scalaPackageClass.this.Predef._"
for all these years,rather than
q"$scalaModule.Predef._"
.This commit makes
mkAttributedRef
special case static ownersby referring the the corresponding module, instead.