Skip to content

Commit c09e1a9

Browse files
committed
Refactor EmptyPrefix logic
1 parent 24e11f2 commit c09e1a9

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

library/src/scala/tasty/reflect/Printers.scala

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,8 +1444,10 @@ trait Printers
14441444

14451445
case Type.SymRef(sym, prefix) =>
14461446
prefix match {
1447-
case Types.EmptyPrefix() =>
1447+
case Type.ThisType(Types.EmptyPackage() | Types.RootPackage()) =>
1448+
case NoPrefix() =>
14481449
if (sym.owner.flags.is(Flags.Package)) {
1450+
// TODO should these be in the prefix? These are at least `scala`, `java` and `scala.collection`.
14491451
val packagePath = sym.owner.fullName.stripPrefix("<root>").stripPrefix("<empty>").stripPrefix(".")
14501452
if (packagePath != "")
14511453
this += packagePath += "."
@@ -1526,7 +1528,7 @@ trait Printers
15261528
this += highlightTypeDef(".this", color)
15271529
case Type.TypeRef(name, prefix) if name.endsWith("$") =>
15281530
prefix match {
1529-
case Types.EmptyPrefix() =>
1531+
case NoPrefix() | Type.ThisType(Types.EmptyPackage() | Types.RootPackage()) =>
15301532
case _ =>
15311533
printTypeOrBound(prefix)
15321534
this += "."
@@ -1823,12 +1825,6 @@ trait Printers
18231825
}
18241826
}
18251827

1826-
object EmptyPrefix {
1827-
def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Boolean = tpe match {
1828-
case NoPrefix() | Type.ThisType(Types.EmptyPackage() | Types.RootPackage()) => true
1829-
case _ => false
1830-
}
1831-
}
18321828
}
18331829

18341830
object PackageObject {

0 commit comments

Comments
 (0)