Commit 49d88a7
committed
Use backend magic to handle super calls
The problem can be seen from the following example:
trait A { def foo() = ??? }
trait B { def foo() = ??? }
object C extends A with B {
super[A].foo()
super[B].foo()
}
In the code above, we cannot translate the following calls
from <init> to <clinit>:
super[A].foo()
super[B].foo()
super[A].$iinit$()
super[B].$init$()
More details can be found here: scala#5928
A principled way would be to generage super accessors as it
is done in posttyper.
However, the backend has a magic to support
prefix to super trees in [1], which is exploited
in the Scala 2 fix [2].
[1] scala/scala#5944
[2] scala/scala#72701 parent 2c29afe commit 49d88a7
File tree
2 files changed
+4
-6
lines changed- compiler/src/dotty/tools/backend/jvm
2 files changed
+4
-6
lines changedLines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
700 | 700 | | |
701 | 701 | | |
702 | 702 | | |
703 | | - | |
| 703 | + | |
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
707 | 707 | | |
708 | 708 | | |
709 | 709 | | |
710 | | - | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
711 | 713 | | |
712 | 714 | | |
713 | 715 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | 159 | | |
164 | 160 | | |
165 | 161 | | |
| |||
0 commit comments