@@ -287,7 +287,17 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
287287 this += " ("
288288 printTree(term)
289289 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)
291301 this += " )"
292302 }
293303
@@ -642,20 +652,20 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
642652 printTypeTree(tpt)
643653 }
644654
645- def printTypeTree (tree : TypeTree , isFullType : Boolean = true ): Buffer = tree match {
655+ def printTypeTree (tree : TypeTree ): Buffer = tree match {
646656 case TypeTree .Synthetic () =>
647- printType(tree.tpe, isFullType )
657+ printType(tree.tpe)
648658 tree.tpe match {
649659 case tpe @ Type .TypeRef (name, _) if name.endsWith(" $" ) => this += " .type"
650660 case tpe => this
651661 }
652662
653663 case TypeTree .TypeIdent (name) =>
654- printType(tree.tpe, isFullType )
664+ printType(tree.tpe)
655665
656666 case TypeTree .TypeSelect (qual, name) =>
657667 (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
659669 case _ => printTree(qual)
660670 }
661671 this += " ." += name
@@ -716,28 +726,28 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
716726 case tpe@ Type () => printType(tpe)
717727 }
718728
719- def printType (tpe : Type , isFullType : Boolean = true ): Buffer = tpe match {
729+ def printType (tpe : Type ): Buffer = tpe match {
720730 case Type .ConstantType (const) =>
721731 printConstant(const)
722732
723733 case Type .SymRef (sym, prefix) =>
724734 prefix match {
725735 case Types .EmptyPrefix () =>
726736 case prefix@ Type .SymRef (ClassDef (_, _, _, _, _), _) =>
727- printType(prefix, isFullType = false )
737+ printType(prefix)
728738 this += " #"
729739 case prefix@ Type () =>
730- printType(prefix, isFullType = false )
740+ printType(prefix)
731741 this += " ."
732742 }
733- printDefinitionName(sym, isFullType )
743+ printDefinitionName(sym)
734744
735745 case Type .TermRef (name, prefix) =>
736746 prefix match {
737747 case Type .ThisType (Types .EmptyPackage ()) =>
738748 this += name
739749 case prefix @ Type () =>
740- printType(prefix, isFullType = false )
750+ printType(prefix)
741751 if (name != " package" )
742752 this += " ." += name
743753 this
@@ -748,7 +758,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
748758 case Type .TypeRef (name, prefix) =>
749759 prefix match {
750760 case NoPrefix () | Type .ThisType (Types .EmptyPackage ()) =>
751- case prefix@ Type () => printType(prefix, isFullType = false ) += " ."
761+ case prefix@ Type () => printType(prefix) += " ."
752762 }
753763 this += name.stripSuffix(" $" )
754764
@@ -799,10 +809,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
799809 case RenameSelector (Id (name), Id (newName)) => this += name += " => " += newName
800810 }
801811
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
806814 case DefDef (name, _, _, _, _) => this += name
807815 case ClassDef (name, _, _, _, _) => this += name.stripSuffix(" $" )
808816 case TypeDef (name, _) => this += name
0 commit comments