@@ -737,14 +737,12 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
737
737
738
738
def printTypeTree (tree : TypeTree ): Buffer = tree match {
739
739
case TypeTree .Synthetic () =>
740
+ // TODO try to move this logic into `printType`
740
741
def printTypeAndAnnots (tpe : Type ): Buffer = tpe match {
741
742
case Type .AnnotatedType (tp, annot) =>
742
743
printTypeAndAnnots(tp)
743
744
this += " "
744
745
printAnnotation(annot)
745
- case tpe @ Type .TypeRef (name, _) if name.endsWith(" $" ) =>
746
- printType(tpe)
747
- this += " .type"
748
746
case Type .SymRef (ClassDef (" Null$" | " Nothing$" , _, _, _, _), Type .ThisType (Type .SymRef (PackageDef (" runtime" , _), NoPrefix ()))) =>
749
747
// scala.runtime.Null$ and scala.runtime.Nothing$ are not modules, those are their actual names
750
748
printType(tpe)
@@ -857,7 +855,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
857
855
case NoPrefix () | Type .ThisType (Types .EmptyPackage ()) =>
858
856
case prefix@ Type () => printType(prefix) += " ."
859
857
}
860
- this += name.stripSuffix(" $" )
858
+ if (name.endsWith(" $" )) this += name.stripSuffix(" $" ) += " .type"
859
+ else this += name
861
860
862
861
case tpe @ Type .Refinement (_, _, _) =>
863
862
printRefinement(tpe)
@@ -896,7 +895,16 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
896
895
case Type .SymRef (cdef @ ClassDef (_, _, _, _, _), _) if ! cdef.flags.isObject =>
897
896
printFullClassName(tp)
898
897
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)
900
908
}
901
909
902
910
case Type .TypeLambda (paramNames, tparams, body) =>
0 commit comments