@@ -737,14 +737,12 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
737737
738738 def printTypeTree (tree : TypeTree ): Buffer = tree match {
739739 case TypeTree .Synthetic () =>
740+ // TODO try to move this logic into `printType`
740741 def printTypeAndAnnots (tpe : Type ): Buffer = tpe match {
741742 case Type .AnnotatedType (tp, annot) =>
742743 printTypeAndAnnots(tp)
743744 this += " "
744745 printAnnotation(annot)
745- case tpe @ Type .TypeRef (name, _) if name.endsWith(" $" ) =>
746- printType(tpe)
747- this += " .type"
748746 case Type .SymRef (ClassDef (" Null$" | " Nothing$" , _, _, _, _), Type .ThisType (Type .SymRef (PackageDef (" runtime" , _), NoPrefix ()))) =>
749747 // scala.runtime.Null$ and scala.runtime.Nothing$ are not modules, those are their actual names
750748 printType(tpe)
@@ -857,7 +855,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
857855 case NoPrefix () | Type .ThisType (Types .EmptyPackage ()) =>
858856 case prefix@ Type () => printType(prefix) += " ."
859857 }
860- this += name.stripSuffix(" $" )
858+ if (name.endsWith(" $" )) this += name.stripSuffix(" $" ) += " .type"
859+ else this += name
861860
862861 case tpe @ Type .Refinement (_, _, _) =>
863862 printRefinement(tpe)
@@ -896,7 +895,16 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
896895 case Type .SymRef (cdef @ ClassDef (_, _, _, _, _), _) if ! cdef.flags.isObject =>
897896 printFullClassName(tp)
898897 this += " .this"
899- case _ => printType(tp)
898+ case Type .TypeRef (name, prefix) if name.endsWith(" $" ) =>
899+ prefix match {
900+ case Types .EmptyPrefix () =>
901+ case _ =>
902+ printTypeOrBound(prefix)
903+ this += " ."
904+ }
905+ this += name.stripSuffix(" $" )
906+ case _ =>
907+ printType(tp)
900908 }
901909
902910 case Type .TypeLambda (paramNames, tparams, body) =>
0 commit comments