Skip to content

Commit 33a2b9c

Browse files
committed
Fix printing super prefix
1 parent 54a423d commit 33a2b9c

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

library/src/scala/tasty/util/ShowSourceCode.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
317317
}
318318

319319
case Term.Super(qual, idOpt) =>
320+
qual match {
321+
case Term.This(Some(Id(name))) => this += name += "."
322+
case Term.This(None) =>
323+
}
320324
this += "super"
321325
for (id <- idOpt) {
322326
val Id(name) = id

tests/run/t4300.decompiled

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/** Decompiled from out/runTestFromTasty/run/t4300/A.class */
2+
trait A() extends java.lang.Object {
3+
def f(): scala.Unit = scala.Predef.println("A")
4+
}
5+
/** Decompiled from out/runTestFromTasty/run/t4300/B.class */
6+
class B() extends A {
7+
def b(): scala.Unit = super[A].f()
8+
trait C() extends java.lang.Object {
9+
def c(): scala.Unit = B.super[A].f()
10+
}
11+
def g(): scala.Unit = scala.Predef.intWrapper(0).until(1).foreach[scala.Unit](((i: scala.Int) => super[A].f()))
12+
def h(): scala.Unit = scala.Predef.intWrapper(0).until(1).foreach[scala.Unit](((i: scala.Int) => B.super[A].f()))
13+
override def f(): scala.Unit = scala.Predef.println("B")
14+
}
15+
/** Decompiled from out/runTestFromTasty/run/t4300/Test.class */
16+
object Test {
17+
def main(args: scala.Array[scala.Predef.String]): scala.Unit = {
18+
val b: B = new B()
19+
b.b()
20+
21+
{
22+
final class $anon() extends b.C()
23+
(new $anon(): b.C)
24+
}.c()
25+
b.g()
26+
b.h()
27+
}
28+
}

0 commit comments

Comments
 (0)