@@ -40,8 +40,8 @@ trait TypesSupport:
40
40
extension (tpeTree : Tree )
41
41
def asSignature : DocSignature =
42
42
tpeTree match
43
- case TypeBoundsTree (low, high) => typeBoundsTreeOfHigherKindedType(low, high)
44
- case tpeTree : TypeTree => inner(tpeTree.tpe)
43
+ case TypeBoundsTree (low, high) => typeBoundsTreeOfHigherKindedType(low.tpe , high.tpe )
44
+ case tpeTree : TypeTree => inner(tpeTree.tpe)
45
45
case term : Term => inner(term.tpe)
46
46
47
47
given TypeSyntax : AnyRef with
@@ -96,7 +96,7 @@ trait TypesSupport:
96
96
inner(tpe)
97
97
case tl @ TypeLambda (params, paramBounds, resType) =>
98
98
texts(" [" ) ++ commas(params.zip(paramBounds).map { (name, typ) =>
99
- val normalizedName = name.takeWhile(_ != '$' )
99
+ val normalizedName = if name.matches( " _ \\ $ \\ d* " ) then " _ " else name
100
100
texts(normalizedName) ++ inner(typ)
101
101
}) ++ texts(" ]" )
102
102
++ texts(" =>> " )
@@ -159,6 +159,8 @@ trait TypesSupport:
159
159
}
160
160
}
161
161
case t @ AppliedType (tpe, typeList) =>
162
+ // if tpe.typeSymbol.normalizedName == "SomeTraitWithHKTs" then
163
+ // println(typeList)
162
164
import dotty .tools .dotc .util .Chars ._
163
165
if ! t.typeSymbol.name.forall(isIdentifierPart) && typeList.size == 2 then
164
166
inner(typeList.head)
@@ -242,7 +244,7 @@ trait TypesSupport:
242
244
// case _ => throw Exception("No match for type in conversion to Reference. This should not happen, please open an issue. " + tp)
243
245
case TypeBounds (low, hi) =>
244
246
if (low == hi) texts(" = " ) ++ inner(low)
245
- else typeBound (low, low = true ) ++ typeBound(hi, low = false )
247
+ else typeBoundsTreeOfHigherKindedType (low, hi )
246
248
247
249
case NoPrefix () => Nil
248
250
@@ -271,17 +273,16 @@ trait TypesSupport:
271
273
case _ => Nil
272
274
}
273
275
274
- private def typeBoundsTreeOfHigherKindedType (low : TypeTree , high : TypeTree ) =
275
- def regularTypeBounds (low : TypeTree , high : TypeTree ) =
276
- typeBound(low.tpe, low = true ) ++ typeBound(high.tpe, low = false )
277
- high.tpe.match
278
- case t : TypeLambda => t.match
279
- case TypeLambda (params, paramBounds, resType) =>
280
- if resType.typeSymbol == defn.AnyClass && params.foldLeft(true )((acc,e) => acc && e.contains(" $" )) then
281
- texts(" [" ) ++ commas(paramBounds.map { typ =>
282
- texts(" _" ) ++ inner(typ)
283
- }) ++ texts(" ]" )
284
- else
285
- regularTypeBounds(low, high)
286
- case _ => regularTypeBounds(low, high)
276
+ private def typeBoundsTreeOfHigherKindedType (low : TypeRepr , high : TypeRepr ) =
277
+ def regularTypeBounds (low : TypeRepr , high : TypeRepr ) =
278
+ typeBound(low, low = true ) ++ typeBound(high, low = false )
279
+ high.match
280
+ case TypeLambda (params, paramBounds, resType) =>
281
+ if resType.typeSymbol == defn.AnyClass then
282
+ texts(" [" ) ++ commas(params.zip(paramBounds).map { (name, typ) =>
283
+ val normalizedName = if name.matches(" _\\ $\\ d*" ) then " _" else name
284
+ texts(normalizedName) ++ inner(typ)
285
+ }) ++ texts(" ]" )
286
+ else
287
+ regularTypeBounds(low, high)
287
288
case _ => regularTypeBounds(low, high)
0 commit comments