Skip to content

Commit 1f1eef3

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

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

tests/neg/6571.check

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
-- [E007] Type Mismatch Error: tests/neg/6571.scala:6:39 ---------------------------------------------------------------
2+
6 | def foo: M[Inv[Int] & Inv[String]] = "" // error
3+
| ^^
4+
| Found: ("" : String)
5+
| Required: Test.M[Test.Inv[Int] & Test.Inv[String]]
6+
|
7+
| Note: a match type could not be fully reduced:
8+
|
9+
| trying to reduce Test.M[Test.Inv[Int] & Test.Inv[String]]
10+
| failed since selector Test.Inv[Int] & Test.Inv[String]
11+
| is uninhabited (there are no values of that type).
12+
|
13+
| longer explanation available when compiling with `-explain`
14+
-- [E007] Type Mismatch Error: tests/neg/6571.scala:7:39 ---------------------------------------------------------------
15+
7 | def bar: M[Inv[String] & Inv[Int]] = 0 // error
16+
| ^
17+
| Found: (0 : Int)
18+
| Required: Test.M[Test.Inv[String] & Test.Inv[Int]]
19+
|
20+
| Note: a match type could not be fully reduced:
21+
|
22+
| trying to reduce Test.M[Test.Inv[String] & Test.Inv[Int]]
23+
| failed since selector Test.Inv[String] & Test.Inv[Int]
24+
| is uninhabited (there are no values of that type).
25+
|
26+
| longer explanation available when compiling with `-explain`

tests/neg/6571.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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+
def bar: M[Inv[String] & Inv[Int]] = 0 // error
8+
}

0 commit comments

Comments
 (0)