@@ -743,10 +743,10 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
743743 printTypeAndAnnots(tp)
744744 this += " "
745745 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$ " ) =>
747747 // scala.runtime.Null$ and scala.runtime.Nothing$ are not modules, those are their actual names
748748 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(" $" ) =>
750750 printType(tpe)
751751 this += " .type"
752752 case tpe => printType(tpe)
@@ -826,7 +826,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
826826 case Type .SymRef (sym, prefix) =>
827827 prefix match {
828828 case Types .EmptyPrefix () =>
829- case IsType (prefix @ Type .SymRef (ClassDef (_ , _, _, _, _), _)) =>
829+ case IsType (prefix @ Type .SymRef (sym , _)) if sym.symbol.isClass =>
830830 printType(prefix)
831831 this += " #"
832832 case IsType (prefix) =>
@@ -892,7 +892,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
892892
893893 case Type .ThisType (tp) =>
894894 tp match {
895- case Type .SymRef (cdef @ ClassDef (_, _, _, _, _) , _) if ! cdef.flags.isObject =>
895+ case Type .SymRef (cdef, _) if ! cdef.flags.isObject =>
896896 printFullClassName(tp)
897897 this += " .this"
898898 case Type .TypeRef (name, prefix) if name.endsWith(" $" ) =>
@@ -958,7 +958,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
958958 val annots = definition.annots.filter {
959959 case Annotation (annot, _) =>
960960 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
962962 case Type .TypeRef (" forceInline" , Types .ScalaPackage ()) => false
963963 case _ => true
964964 }
@@ -1055,7 +1055,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
10551055 def printProtectedOrPrivate (definition : Definition ): Boolean = {
10561056 var prefixWasPrinted = false
10571057 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
10591060 case _ => printFullClassName(within)
10601061 }
10611062 if (definition.flags.isProtected) {
@@ -1082,14 +1083,14 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
10821083
10831084 def printFullClassName (tp : TypeOrBounds ): Unit = {
10841085 def printClassPrefix (prefix : TypeOrBounds ): Unit = prefix match {
1085- case Type .SymRef (ClassDef (name, _, _, _, _), prefix2) =>
1086+ case Type .SymRef (sym, prefix2) if sym.symbol.isClass =>
10861087 printClassPrefix(prefix2)
1087- this += name += " ."
1088+ this += sym. name += " ."
10881089 case _ =>
10891090 }
1090- val Type .SymRef (ClassDef (name, _, _, _, _) , prefix) = tp
1091+ val Type .SymRef (sym , prefix) = tp
10911092 printClassPrefix(prefix)
1092- this += name
1093+ this += sym. name
10931094 }
10941095
10951096 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
11211122 def unapply (arg : Tree )(implicit ctx : Context ): Option [(String , List [Term ])] = arg match {
11221123 case IsTerm (arg @ Term .Apply (fn, args)) =>
11231124 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>" =>
11251126 Some ((op, args))
11261127 case _ => None
11271128 }
@@ -1143,7 +1144,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
11431144
11441145 object JavaLangObject {
11451146 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
11471148 case _ => false
11481149 }
11491150 }
0 commit comments