File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -352,6 +352,8 @@ trait ConstraintHandling {
352352 val pKept = if level1 <= level2 then p1 else p2
353353 val pRemoved = if level1 <= level2 then p2 else p1
354354
355+ val down = constraint.exclusiveLower(p2, p1)
356+
355357 constraint = constraint.addLess(p2, p1, direction = if pKept eq p1 then KeepParam2 else KeepParam1)
356358
357359 val boundKept = constraint.nonParamBounds(pKept).substParam(pRemoved, pKept)
@@ -371,7 +373,6 @@ trait ConstraintHandling {
371373 if !isSub(lo, hi) then
372374 boundRemoved = TypeBounds(lo & hi, hi)
373375
374- val down = constraint.exclusiveLower(p2, p1)
375376 val up = constraint.exclusiveUpper(p1, p2)
376377
377378 val newBounds = (boundKept & boundRemoved).bounds
Original file line number Diff line number Diff line change 1+ def test[X, A >: X <: X, B <: Int] = {
2+ enum Expr[+T]:
3+ case TagA() extends Expr[A]
4+ case TagB() extends Expr[B]
5+
6+ import Expr._
7+
8+ def foo(e1: Expr[A], e2: Expr[B]) = e1 match {
9+ case TagB() => // add GADT constr: B <: A
10+ e2 match {
11+ case TagA() =>
12+ // add GADT constr: A <: B
13+ // should propagate bound X (<: A <: B) <: Int for X.
14+ val t0: X = ???
15+ val t1: Int = t0 // should work too
16+ val t2: Int = t0 : A // works
17+ case _ =>
18+ }
19+ case _ =>
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments