Commit e5bba0a
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 1d88cd2 commit e5bba0a
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 | |
|---|---|---|---|
| |||
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
706 | | - | |
| 706 | + | |
707 | 707 | | |
708 | 708 | | |
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
713 | | - | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
714 | 716 | | |
715 | 717 | | |
716 | 718 | | |
| |||
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