Skip to content

Commit 3926092

Browse files
committed
Print ".type" for singleton types
1 parent 35cf4a6 commit 3926092

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
621621

622622
case TypeTree.Singleton(ref) =>
623623
printTree(ref)
624+
this += ".type"
624625

625626
case TypeTree.Refined(tpt, refinements) =>
626627
printTypeTree(tpt)

tests/pos/simpleSingleton.decompiled

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/** Decompiled from out/posTestFromTasty/pos/simpleSingleton/Foo.class */
2+
class Foo() {
3+
def foo(x: scala.Int): scala.Unit = {
4+
val a: x.type = x
5+
val b: Foo.type = Foo
6+
()
7+
}
8+
}
9+
object Foo

tests/pos/simpleSingleton.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Foo {
2+
def foo(x: Int) = {
3+
val a: x.type = x
4+
val b: Foo.type = Foo
5+
}
6+
}
7+
8+
object Foo

0 commit comments

Comments
 (0)