@@ -68,10 +68,12 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
6868 printDefAnnotations(cdef)
6969
7070 val flags = cdef.flags
71+ if (flags.isImplicit) this += " implicit "
7172 if (flags.isFinal && ! flags.isObject) this += " final "
7273 if (flags.isCase) this += " case "
7374
7475 if (flags.isObject) this += " object " += name.stripSuffix(" $" )
76+ else if (flags.isTrait) this += " trait " += name
7577 else this += " class " += name
7678
7779 if (! flags.isObject) {
@@ -93,7 +95,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
9395 this += " "
9496 printTypeTree(tpt)
9597 this += " ["
96- printTypeTrees (targs, " , " )
98+ printTypeOrBoundsTrees (targs, " , " )
9799 this += " ]"
98100 if (args.nonEmpty) {
99101 this += " ("
@@ -157,6 +159,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
157159 printDefAnnotations(vdef)
158160
159161 val flags = vdef.flags
162+ if (flags.isImplicit) this += " implicit "
160163 if (flags.isOverride) this += " override "
161164
162165 if (flags.isLazy) this += " lazy "
@@ -210,7 +213,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
210213 printDefAnnotations(ddef)
211214
212215 val flags = ddef.flags
213- if (flags.isOverride) sb.append(" override " )
216+ if (flags.isImplicit) this += " implicit "
217+ if (flags.isOverride) this += " override "
214218
215219 this += " def " += name
216220 printTargsDefs(targs)
@@ -271,7 +275,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
271275 case Term .TypeApply (fn, args) =>
272276 printTree(fn)
273277 this += " ["
274- printTypeTrees (args, " , " )
278+ printTypeOrBoundsTrees (args, " , " )
275279 this += " ]"
276280
277281 case Term .Super (qual, tptOpt) =>
@@ -451,12 +455,12 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
451455 this
452456 }
453457
454- def printTypeTrees (typesTrees : List [TypeTree ], sep : String ): Buffer = {
455- def printSeparated (list : List [TypeTree ]): Unit = list match {
458+ def printTypeOrBoundsTrees (typesTrees : List [TypeOrBoundsTree ], sep : String ): Buffer = {
459+ def printSeparated (list : List [TypeOrBoundsTree ]): Unit = list match {
456460 case Nil =>
457- case x :: Nil => printTypeTree (x)
461+ case x :: Nil => printTypeOrBoundsTree (x)
458462 case x :: xs =>
459- printTypeTree (x)
463+ printTypeOrBoundsTree (x)
460464 this += sep
461465 printSeparated(xs)
462466 }
@@ -496,34 +500,41 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
496500
497501 def printTargDef (arg : TypeDef , isMember : Boolean = false ): Buffer = {
498502 val TypeDef (name, rhs) = arg
503+ def printBounds (bounds : TypeBoundsTree ): Buffer = {
504+ val TypeBoundsTree (lo, hi) = bounds
505+ lo match {
506+ case TypeTree .Synthetic () =>
507+ case _ =>
508+ this += " >: "
509+ printTypeTree(lo)
510+ }
511+ hi match {
512+ case TypeTree .Synthetic () => this
513+ case _ =>
514+ this += " <: "
515+ printTypeTree(hi)
516+ }
517+ }
499518 this += name
500519 rhs match {
501- case TypeBoundsTree (lo, hi) =>
502- lo match {
503- case TypeTree .Synthetic () => this
504- case _ =>
505- this += " >: "
506- printTypeTree(lo)
507- }
508- hi match {
509- case TypeTree .Synthetic () => this
510- case _ =>
511- this += " <: "
512- printTypeTree(hi)
513- }
520+ case rhs @ TypeBoundsTree (lo, hi) => printBounds(rhs)
514521 case rhs @ SyntheticBounds () =>
515522 printTypeOrBound(rhs.tpe)
516523 case rhs @ TypeTree .TypeLambdaTree (tparams, body) =>
524+ def printParam (t : TypeOrBoundsTree ): Unit = t match {
525+ case t @ TypeBoundsTree (_, _) => printBounds(t)
526+ case t @ TypeTree () => printTypeTree(t)
527+ }
517528 def printSeparated (list : List [TypeDef ]): Unit = list match {
518529 case Nil =>
519530 case x :: Nil =>
520531 val TypeDef (name, trhs) = x
521532 this += name
522- printTypeOrBoundsTree (trhs)
533+ printParam (trhs)
523534 case x :: xs =>
524535 val TypeDef (name, trhs) = x
525536 this += name
526- printTypeOrBoundsTree (trhs)
537+ printParam (trhs)
527538 this += " , "
528539 printSeparated(xs)
529540 }
@@ -664,7 +675,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
664675
665676 def printTypeOrBoundsTree (tpt : TypeOrBoundsTree ): Buffer = tpt match {
666677 case TypeBoundsTree (lo, hi) =>
667- this += " >: "
678+ this += " _ >: "
668679 printTypeTree(lo)
669680 this += " <: "
670681 printTypeTree(hi)
@@ -723,7 +734,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
723734 case TypeTree .Applied (tpt, args) =>
724735 printTypeTree(tpt)
725736 this += " ["
726- printTypeTrees (args, " , " )
737+ printTypeOrBoundsTrees (args, " , " )
727738 this += " ]"
728739
729740 case TypeTree .Annotated (tpt, annot) =>
0 commit comments