@@ -148,7 +148,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
148148
149149 case tdef@ TypeDef (name, rhs) =>
150150 this += " type "
151- printTargDef(tdef)
151+ printTargDef(tdef, isMember = true )
152152
153153 case vdef@ ValDef (name, tpt, rhs) =>
154154 val flags = vdef.flags
@@ -469,7 +469,7 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
469469 }
470470 }
471471
472- def printTargDef (arg : TypeDef ): Buffer = {
472+ def printTargDef (arg : TypeDef , isMember : Boolean = false ): Buffer = {
473473 val TypeDef (name, rhs) = arg
474474 this += name
475475 rhs match {
@@ -488,6 +488,28 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
488488 }
489489 case rhs @ SyntheticBounds () =>
490490 printTypeOrBound(rhs.tpe)
491+ case rhs @ TypeTree .TypeLambdaTree (tparams, body) =>
492+ def printSeparated (list : List [TypeDef ]): Unit = list match {
493+ case Nil =>
494+ case x :: Nil =>
495+ val TypeDef (name, trhs) = x
496+ this += name
497+ printTypeOrBoundsTree(trhs)
498+ case x :: xs =>
499+ val TypeDef (name, trhs) = x
500+ this += name
501+ printTypeOrBoundsTree(trhs)
502+ this += " , "
503+ printSeparated(xs)
504+ }
505+ this += " ["
506+ printSeparated(tparams)
507+ this += " ]"
508+ if (isMember) {
509+ this += " = "
510+ printTypeOrBoundsTree(body)
511+ }
512+ else this
491513 case rhs @ TypeTree () =>
492514 this += " = "
493515 printTypeTree(rhs)
@@ -672,6 +694,11 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
672694 this += " => "
673695 printTypeTree(result)
674696
697+ case TypeTree .TypeLambdaTree (tparams, body) =>
698+ printTargsDefs(tparams)
699+ this += " => "
700+ printTypeOrBoundsTree(body)
701+
675702 case _ =>
676703 throw new MatchError (tree.show)
677704
@@ -757,6 +784,30 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
757784 case _ => this
758785 }
759786
787+ case Type .TypeLambda (paramNames, tparams, body) =>
788+ this += " ["
789+ def printSeparated (list : List [(String , TypeBounds )]): Unit = list match {
790+ case Nil =>
791+ case (name, bounds) :: Nil =>
792+ this += name
793+ printTypeOrBound(bounds)
794+ case (name, bounds) :: xs =>
795+ this += name
796+ printTypeOrBound(bounds)
797+ this += " , "
798+ printSeparated(xs)
799+ }
800+ printSeparated(paramNames.zip(tparams))
801+ this += " ] => "
802+ printTypeOrBound(body)
803+
804+ case Type .ParamRef (lambda, idx) =>
805+ lambda match {
806+ case Type .MethodType (params, _, _) => this += params(idx)
807+ case Type .PolyType (params, _, _) => this += params(idx)
808+ case Type .TypeLambda (params, _, _) => this += params(idx)
809+ }
810+
760811 case _ =>
761812 throw new MatchError (tpe.show)
762813 }
0 commit comments