Commit 8bd04ad
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 3984661 commit 8bd04ad
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 | |
|---|---|---|---|
| |||
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
713 | | - | |
| 713 | + | |
714 | 714 | | |
715 | 715 | | |
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
720 | | - | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
721 | 723 | | |
722 | 724 | | |
723 | 725 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | 160 | | |
165 | 161 | | |
166 | 162 | | |
| |||
0 commit comments