-
Notifications
You must be signed in to change notification settings - Fork 1.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
Fix #1441: init MODULE$ in <clinit> #9181
Conversation
c86ca4d
to
49d88a7
Compare
37fac7f
to
6ca1b10
Compare
Good work! For generating super accessors you can use |
7c768a3
to
475ee8b
Compare
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/9181/ to see the changes. Benchmarks is based on merging with master (0f1a23e) |
c794429
to
43c8159
Compare
This is a port of the following PR in Scala 2: scala/scala#3935
Otherwise, we will need to support trees like `C.this.$outer.super[D]` as in Scala 2, which complicates invariants about super.
Co-authored-by: Guillaume Martres <smarter@ubuntu.com>
We should check the type instead, which is more semantic.
Still we have a problem with the following magic: https://github.com/scala/scala/pull/7270/files#r221195225 It is a magic for two reasons: 1. It generates `getstatic` for `Select(This(O$), x)` 2. It is not affected by compilation order of classes For the second, suppose the backend compiles `A$B` before `A`. Then the class `A$B` does not see that `x` is static, which should cause problem at runtime: ``` object A { private[this] val x: Int = 10 class B { val y = x } } ``` The following are the reasons why it works in scalac: 1. inner classes always come after the outer class 2. non `private[this]` fields are accessed via accessor methods, which are not static 3. inside the module class, access to the fields are compiled after setting the static flag 4. the code generation specialize for trees like `Select(This(O$), x)`, where `x` is a static member
The magic in scalac is order-dependent: https://github.com/scala/scala/pull/7270/files#r221195225 See the previous commit for more detailed info.
There are compilation errors due to changes between 8 and 11 - addition of `String.lines` shadows the deprecated `StringOps.lines` in stdlib * probblem for ScalaTest - JAXB APIs are removed * problem for BetterFiles
test performance please |
performance test scheduled: 1 job(s) in queue, 1 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/9181/ to see the changes. Benchmarks is based on merging with master (b8825a2) |
Fix #1441: init $MODULE in
<clinit>
Related: #5928 #8652