Skip to content

Commit 3155f67

Browse files
Fix #6571: Add regression test
1 parent 8d3083b commit 3155f67

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/neg/6571.scala

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
object Test {
2+
class Inv[T]
3+
type M[t] = t match {
4+
case Inv[u] => u
5+
}
6+
def foo: M[Inv[Int] & Inv[String]] = "" // error
7+
// ^^
8+
// Found: ("" : String)
9+
// Required: Test.M[Test.Inv[Int] & Test.Inv[String]]
10+
//
11+
// Note: a match type could not be fully reduced:
12+
//
13+
// trying to reduce Test.M[Test.Inv[Int] & Test.Inv[String]]
14+
// failed since selector Test.Inv[Int] & Test.Inv[String]
15+
// is uninhabited (there are no values of that type).
16+
17+
18+
def bar: M[Inv[String] & Inv[Int]] = 0 // error
19+
// ^
20+
// Found: (0 : Int)
21+
// Required: Test.M[Test.Inv[String] & Test.Inv[Int]]
22+
23+
// Note: a match type could not be fully reduced:
24+
25+
// trying to reduce Test.M[Test.Inv[String] & Test.Inv[Int]]
26+
// failed since selector Test.Inv[String] & Test.Inv[Int]
27+
// is uninhabited (there are no values of that type).
28+
}

0 commit comments

Comments
 (0)