File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
library/src/scala/tasty/util Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -145,14 +145,30 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
145145 case stat@ Import (_, _) => stat
146146 case stat@ Term () => stat
147147 }
148- if (stats1.nonEmpty) {
148+
149+ def printBody (printSelf : Boolean ) = {
149150 this += " {"
150151 indented {
152+ if (printSelf) {
153+ val Some (ValDef (name, tpt, _)) = self
154+ indented {
155+ val name1 = if (name == " _" ) " this" else name
156+ this += " " += name1 += " : "
157+ printTypeTree(tpt)
158+ this += " =>"
159+ }
160+ }
151161 this += lineBreak()
152162 printTrees(stats1, lineBreak())
153163 }
154164 this += lineBreak() += " }"
155165 }
166+ self match {
167+ case Some (ValDef (_, TypeTree .Singleton (_), _)) =>
168+ if (stats1.nonEmpty) printBody(printSelf = false )
169+ case Some (ValDef (_, _, _)) => printBody(printSelf = true )
170+ case _ => if (stats1.nonEmpty) printBody(printSelf = false )
171+ }
156172 this
157173
158174 case tdef @ TypeDef (name, rhs) =>
Original file line number Diff line number Diff line change 1+ /** Decompiled from out/posTestFromTasty/pos/selftypes/selftypes.class */
2+ object selftypes {
3+ trait A() extends java.lang.Object { self: selftypes.AB =>
4+ type AA = scala.List[this.BX]
5+ class AX()
6+ }
7+ trait B() extends java.lang.Object { self: selftypes.AB =>
8+ type BB = B.this.AA
9+ class BX()
10+ }
11+ class AB() extends selftypes.A with selftypes.B
12+ }
You can’t perform that action at this time.
0 commit comments