File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -345,7 +345,7 @@ trait ConstraintHandling[AbstractContext] {
345345 else {
346346 val saved = constraint
347347 try
348- c2 .forallParams(p =>
348+ pre .forallParams(p =>
349349 c1.contains(p) &&
350350 c2.upper(p).forall(c1.isLess(p, _)) &&
351351 isSubTypeWhenFrozen(c1.nonParamBounds(p), c2.nonParamBounds(p)))
Original file line number Diff line number Diff line change @@ -2,16 +2,26 @@ object Test {
22 trait T1 [A ] { def a : A }
33 trait T2 [B ] { def b : B }
44
5- def foo [X , Y ](u : T1 [X ] | T2 [Y ]): X = u match {
5+ def foo [X , Y ](v : T1 [X ] | T2 [Y ]): X = v match {
66 case t1 : T1 [t] =>
77 // consider: foo[Int, String](new T1[String] with T2[String] { ... })
88 t1.a // error
99 }
1010
1111 class T1Int extends T1 [Int ] { def a = 0 }
12- def bar [X , Y ](u : T1 [X ] | T2 [Y ]): X = u match {
12+ def bar [X , Y ](v : T1 [X ] | T2 [Y ]): X = v match {
1313 case t1 : T1Int =>
1414 // similar reasoning to above applies
1515 t1.a // error
1616 }
17+
18+ class T1IntT2String extends T1 [Int ] with T2 [String ] {
19+ def a = 0
20+ def b = " "
21+ }
22+ def baz [X ](v : T1 [X ] | T2 [X ]): Unit = v match {
23+ case _ : T1IntT2String =>
24+ val x1 : X = 0 // error
25+ val x2 : X = " " // error
26+ }
1727}
You can’t perform that action at this time.
0 commit comments