We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent add83c3 commit bb24b51Copy full SHA for bb24b51
tests/neg/i23435-min.scala
@@ -0,0 +1,6 @@
1
+
2
+type Or[+A, +B] = A | B
3
4
+val x: Or[Int, String] & Or[String, Int] = 3
5
+val y: Or[Int & String, Int & String] = x // error
6
+val z: Int & String = y
tests/neg/i23435.scala
@@ -0,0 +1,16 @@
+trait L[+A]{val a:A}
+trait R[+B]{val b: B}
+class LR(val a: Int, val b: String) extends L[Int] with R[String]
7
+type E[+A] = L[A] | R[A]
8
9
+val x: E[Int] & E[String] = LR(4, "hi")
10
+val y: E[Int&String] = x // error
11
12
+val z = y match
13
+ case l : L[Int&String] => l.a
14
+ case r : R[Int&String] => r.b
15
16
+val _ = z:String // was: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String
0 commit comments