Skip to content

Commit bc44444

Browse files
committed
Avoid replacing type lambda params with normal params
Type lambdas shgould be short lived, so we should avoid instantiating normal poly params to type lambda params.
1 parent d508d9f commit bc44444

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ trait ConstraintHandling {
8989
protected def addLess(p1: PolyParam, p2: PolyParam): Boolean = {
9090
def description = i"ordering $p1 <: $p2 to\n$constraint"
9191
val res =
92-
if (constraint.isLess(p2, p1)) unify(p2, p1)
92+
if (constraint.isLess(p2, p1))
93+
if (p2.binder.isInstanceOf[TypeLambda] && !p1.binder.isInstanceOf[TypeLambda])
94+
unify(p1, p2)
95+
else
96+
unify(p2, p1)
9397
else {
9498
val down1 = p1 :: constraint.exclusiveLower(p1, p2)
9599
val up2 = p2 :: constraint.exclusiveUpper(p2, p1)
@@ -109,7 +113,6 @@ trait ConstraintHandling {
109113
*/
110114
private def unify(p1: PolyParam, p2: PolyParam): Boolean = {
111115
constr.println(s"unifying $p1 $p2")
112-
assert(constraint.isLess(p1, p2))
113116
val down = constraint.exclusiveLower(p2, p1)
114117
val up = constraint.exclusiveUpper(p1, p2)
115118
needsCleanup = true

0 commit comments

Comments
 (0)