@@ -743,10 +743,10 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
743
743
printTypeAndAnnots(tp)
744
744
this += " "
745
745
printAnnotation(annot)
746
- case Type .SymRef (ClassDef ( " Null$ " | " Nothing$ " , _, _, _, _), Type .ThisType (Type .SymRef (PackageDef (" runtime" , _), NoPrefix ()))) =>
746
+ case Type .SymRef (sym, Type .ThisType (Type .SymRef (PackageDef (" runtime" , _), NoPrefix ()))) if sym.symbol.isClass && (sym.symbol.name == " Null$ " || sym.symbol.name == " Nothing$ " ) =>
747
747
// scala.runtime.Null$ and scala.runtime.Nothing$ are not modules, those are their actual names
748
748
printType(tpe)
749
- case tpe @ Type .SymRef (ClassDef (name , _, _, _, _), _) if name.endsWith(" $" ) =>
749
+ case tpe @ Type .SymRef (sym , _) if sym.symbol.isClass && sym. name.endsWith(" $" ) =>
750
750
printType(tpe)
751
751
this += " .type"
752
752
case tpe => printType(tpe)
@@ -826,7 +826,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
826
826
case Type .SymRef (sym, prefix) =>
827
827
prefix match {
828
828
case Types .EmptyPrefix () =>
829
- case IsType (prefix @ Type .SymRef (ClassDef (_ , _, _, _, _), _)) =>
829
+ case IsType (prefix @ Type .SymRef (sym , _)) if sym.symbol.isClass =>
830
830
printType(prefix)
831
831
this += " #"
832
832
case IsType (prefix) =>
@@ -892,7 +892,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
892
892
893
893
case Type .ThisType (tp) =>
894
894
tp match {
895
- case Type .SymRef (cdef @ ClassDef (_, _, _, _, _) , _) if ! cdef.flags.isObject =>
895
+ case Type .SymRef (cdef, _) if ! cdef.flags.isObject =>
896
896
printFullClassName(tp)
897
897
this += " .this"
898
898
case Type .TypeRef (name, prefix) if name.endsWith(" $" ) =>
@@ -958,7 +958,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
958
958
val annots = definition.annots.filter {
959
959
case Annotation (annot, _) =>
960
960
annot.tpe match {
961
- case Type .TypeRef (_, Type .SymRef (PackageDef ( " internal " , _), Type . ThisType ( Type . SymRef ( PackageDef ( " annotation" , _), NoPrefix ())))) => false
961
+ case Type .TypeRef (_, Type .SymRef (sym , _)) if sym.symbol.fullName == " scala. annotation.internal " => false
962
962
case Type .TypeRef (" forceInline" , Types .ScalaPackage ()) => false
963
963
case _ => true
964
964
}
@@ -1055,7 +1055,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
1055
1055
def printProtectedOrPrivate (definition : Definition ): Boolean = {
1056
1056
var prefixWasPrinted = false
1057
1057
def printWithin (within : Type ) = within match {
1058
- case Type .SymRef (PackageDef (name, _), _) => this += name
1058
+ case Type .SymRef (sym @ PackageDef (name, _), _) =>
1059
+ this += sym.name
1059
1060
case _ => printFullClassName(within)
1060
1061
}
1061
1062
if (definition.flags.isProtected) {
@@ -1082,14 +1083,14 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
1082
1083
1083
1084
def printFullClassName (tp : TypeOrBounds ): Unit = {
1084
1085
def printClassPrefix (prefix : TypeOrBounds ): Unit = prefix match {
1085
- case Type .SymRef (ClassDef (name, _, _, _, _), prefix2) =>
1086
+ case Type .SymRef (sym, prefix2) if sym.symbol.isClass =>
1086
1087
printClassPrefix(prefix2)
1087
- this += name += " ."
1088
+ this += sym. name += " ."
1088
1089
case _ =>
1089
1090
}
1090
- val Type .SymRef (ClassDef (name, _, _, _, _) , prefix) = tp
1091
+ val Type .SymRef (sym , prefix) = tp
1091
1092
printClassPrefix(prefix)
1092
- this += name
1093
+ this += sym. name
1093
1094
}
1094
1095
1095
1096
def += (x : Boolean ): this .type = { sb.append(x); this }
@@ -1121,7 +1122,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
1121
1122
def unapply (arg : Tree )(implicit ctx : Context ): Option [(String , List [Term ])] = arg match {
1122
1123
case IsTerm (arg @ Term .Apply (fn, args)) =>
1123
1124
fn.tpe match {
1124
- case Type .SymRef (DefDef (op, _, _, _, _), Type .ThisType (Type .SymRef (PackageDef ( " <special-ops>" , _), NoPrefix ()))) =>
1125
+ case Type .SymRef (DefDef (op, _, _, _, _), Type .ThisType (Type .SymRef (sym, _))) if sym.name == " <special-ops>" =>
1125
1126
Some ((op, args))
1126
1127
case _ => None
1127
1128
}
@@ -1143,7 +1144,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
1143
1144
1144
1145
object JavaLangObject {
1145
1146
def unapply (tpe : Type )(implicit ctx : Context ): Boolean = tpe match {
1146
- case Type .TypeRef (" Object" , Type .SymRef (PackageDef ( " lang " , _), Type . ThisType ( Type . SymRef ( PackageDef ( " java" , _), NoPrefix ())))) => true
1147
+ case Type .TypeRef (" Object" , Type .SymRef (sym , _)) if sym.symbol.fullName == " java.lang " => true
1147
1148
case _ => false
1148
1149
}
1149
1150
}
0 commit comments