Skip to content

Commit

Permalink
Fix printing super prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Jun 22, 2018
1 parent 54a423d commit 33a2b9c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/src/scala/tasty/util/ShowSourceCode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
}

case Term.Super(qual, idOpt) =>
qual match {
case Term.This(Some(Id(name))) => this += name += "."
case Term.This(None) =>
}
this += "super"
for (id <- idOpt) {
val Id(name) = id
Expand Down
28 changes: 28 additions & 0 deletions tests/run/t4300.decompiled
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/** Decompiled from out/runTestFromTasty/run/t4300/A.class */
trait A() extends java.lang.Object {
def f(): scala.Unit = scala.Predef.println("A")
}
/** Decompiled from out/runTestFromTasty/run/t4300/B.class */
class B() extends A {
def b(): scala.Unit = super[A].f()
trait C() extends java.lang.Object {
def c(): scala.Unit = B.super[A].f()
}
def g(): scala.Unit = scala.Predef.intWrapper(0).until(1).foreach[scala.Unit](((i: scala.Int) => super[A].f()))
def h(): scala.Unit = scala.Predef.intWrapper(0).until(1).foreach[scala.Unit](((i: scala.Int) => B.super[A].f()))
override def f(): scala.Unit = scala.Predef.println("B")
}
/** Decompiled from out/runTestFromTasty/run/t4300/Test.class */
object Test {
def main(args: scala.Array[scala.Predef.String]): scala.Unit = {
val b: B = new B()
b.b()

{
final class $anon() extends b.C()
(new $anon(): b.C)
}.c()
b.g()
b.h()
}
}

0 comments on commit 33a2b9c

Please sign in to comment.