File tree 1 file changed +8
-4
lines changed
compiler/src/dotty/tools/dotc/core
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -524,17 +524,21 @@ trait ConstraintHandling[AbstractContext] {
524
524
pruneLambdaParams(bound)
525
525
}
526
526
527
- def sameKind (tp1 : Type , tp2 : Type ): Boolean =
528
- tp1.typeParams.corresponds(tp2.typeParams)((p1, p2) =>
529
- sameKind(p1.paramInfo, p2.paramInfo))
527
+ def kindCompatible (tp1 : Type , tp2 : Type ): Boolean =
528
+ val tparams1 = tp1.typeParams
529
+ val tparams2 = tp2.typeParams
530
+ tparams1.corresponds(tparams2)((p1, p2) => kindCompatible(p1.paramInfo, p2.paramInfo))
531
+ && (tparams1.isEmpty || kindCompatible(tp1.hkResult, tp2.hkResult))
532
+ || tp1.hasAnyKind
533
+ || tp2.hasAnyKind
530
534
531
535
try bound match {
532
536
case bound : TypeParamRef if constraint contains bound =>
533
537
addParamBound(bound)
534
538
case _ =>
535
539
val pbound = prune(bound)
536
540
pbound.exists
537
- && sameKind (param, pbound)
541
+ && kindCompatible (param, pbound)
538
542
&& (if fromBelow then addLowerBound(param, pbound) else addUpperBound(param, pbound))
539
543
}
540
544
finally addConstraintInvocations -= 1
You can’t perform that action at this time.
0 commit comments