Skip to content

Commit 1c77b03

Browse files
committed
Fix TypeLambda extractor.
As remarked by @smarter, argInfos does not work for type lambdas, so argBoundss is always Nil.
1 parent 169c8dc commit 1c77b03

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/dotty/tools/dotc/core/TypeApplications.scala

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,18 @@ object TypeApplications {
7070
}
7171

7272
def unapply(tp: Type)(implicit ctx: Context): Option[(List[Int], List[TypeBounds], Type)] = tp match {
73-
case app @ RefinedType(prefix, tpnme.hkApply) =>
74-
val cls = prefix.typeSymbol
73+
case app @ RefinedType(parent, tpnme.hkApply) =>
74+
val cls = parent.typeSymbol
7575
val variances = cls.typeParams.map(_.variance)
76-
val argBounds = prefix.argInfos.map(_.bounds)
76+
def collectBounds(t: Type, acc: List[TypeBounds]): List[TypeBounds] = t match {
77+
case t @ RefinedType(p, rname) =>
78+
assert(rname.isHkArgName)
79+
collectBounds(p, t.refinedInfo.bounds :: acc)
80+
case TypeRef(_, lname) =>
81+
assert(lname.isLambdaTraitName)
82+
acc
83+
}
84+
val argBounds = collectBounds(parent, Nil)
7785
Some((variances, argBounds, app.refinedInfo.argInfo))
7886
case _ =>
7987
None

0 commit comments

Comments
 (0)