@@ -287,7 +287,17 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
287
287
this += " ("
288
288
printTree(term)
289
289
this += " : "
290
- printTypeTree(tpt, isFullType = true )
290
+ def printTypeOrAnnots (tpe : Type ): Unit = tpe match {
291
+ case Type .AnnotatedType (tp, annot) if tp == term.tpe =>
292
+ printAnnotation(annot)
293
+ case Type .AnnotatedType (tp, annot) =>
294
+ printTypeOrAnnots(tp)
295
+ this += " "
296
+ printAnnotation(annot)
297
+ case tpe =>
298
+ printType(tpe)
299
+ }
300
+ printTypeOrAnnots(tpt.tpe)
291
301
this += " )"
292
302
}
293
303
@@ -642,20 +652,20 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
642
652
printTypeTree(tpt)
643
653
}
644
654
645
- def printTypeTree (tree : TypeTree , isFullType : Boolean = true ): Buffer = tree match {
655
+ def printTypeTree (tree : TypeTree ): Buffer = tree match {
646
656
case TypeTree .Synthetic () =>
647
- printType(tree.tpe, isFullType )
657
+ printType(tree.tpe)
648
658
tree.tpe match {
649
659
case tpe @ Type .TypeRef (name, _) if name.endsWith(" $" ) => this += " .type"
650
660
case tpe => this
651
661
}
652
662
653
663
case TypeTree .TypeIdent (name) =>
654
- printType(tree.tpe, isFullType )
664
+ printType(tree.tpe)
655
665
656
666
case TypeTree .TypeSelect (qual, name) =>
657
667
(qual : Any ) match {
658
- case qual @ TypeTree .TypeIdent (_) => printTypeTree(qual, isFullType = false ) // FIXME: qual is of type Tree buy we are getting a TypeTree qualifier
668
+ case qual @ TypeTree .TypeIdent (_) => printTypeTree(qual) // FIXME: qual is of type Tree buy we are getting a TypeTree qualifier
659
669
case _ => printTree(qual)
660
670
}
661
671
this += " ." += name
@@ -716,28 +726,28 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
716
726
case tpe@ Type () => printType(tpe)
717
727
}
718
728
719
- def printType (tpe : Type , isFullType : Boolean = true ): Buffer = tpe match {
729
+ def printType (tpe : Type ): Buffer = tpe match {
720
730
case Type .ConstantType (const) =>
721
731
printConstant(const)
722
732
723
733
case Type .SymRef (sym, prefix) =>
724
734
prefix match {
725
735
case Types .EmptyPrefix () =>
726
736
case prefix@ Type .SymRef (ClassDef (_, _, _, _, _), _) =>
727
- printType(prefix, isFullType = false )
737
+ printType(prefix)
728
738
this += " #"
729
739
case prefix@ Type () =>
730
- printType(prefix, isFullType = false )
740
+ printType(prefix)
731
741
this += " ."
732
742
}
733
- printDefinitionName(sym, isFullType )
743
+ printDefinitionName(sym)
734
744
735
745
case Type .TermRef (name, prefix) =>
736
746
prefix match {
737
747
case Type .ThisType (Types .EmptyPackage ()) =>
738
748
this += name
739
749
case prefix @ Type () =>
740
- printType(prefix, isFullType = false )
750
+ printType(prefix)
741
751
if (name != " package" )
742
752
this += " ." += name
743
753
this
@@ -748,7 +758,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
748
758
case Type .TypeRef (name, prefix) =>
749
759
prefix match {
750
760
case NoPrefix () | Type .ThisType (Types .EmptyPackage ()) =>
751
- case prefix@ Type () => printType(prefix, isFullType = false ) += " ."
761
+ case prefix@ Type () => printType(prefix) += " ."
752
762
}
753
763
this += name.stripSuffix(" $" )
754
764
@@ -799,10 +809,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
799
809
case RenameSelector (Id (name), Id (newName)) => this += name += " => " += newName
800
810
}
801
811
802
- def printDefinitionName (sym : Definition , isFullType : Boolean ): Buffer = sym match {
803
- case ValDef (name, _, _) =>
804
- if (isFullType) this += name += " .type"
805
- else this += name
812
+ def printDefinitionName (sym : Definition ): Buffer = sym match {
813
+ case ValDef (name, _, _) => this += name
806
814
case DefDef (name, _, _, _, _) => this += name
807
815
case ClassDef (name, _, _, _, _) => this += name.stripSuffix(" $" )
808
816
case TypeDef (name, _) => this += name
0 commit comments