Skip to content

Commit

Permalink
Fix scala#6571: Add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierBlanvillain authored and michelou committed Apr 25, 2022
1 parent 633812e commit 133cb46
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/neg/6571.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-- [E007] Type Mismatch Error: tests/neg/6571.scala:6:39 ---------------------------------------------------------------
6 | def foo: M[Inv[Int] & Inv[String]] = "" // error
| ^^
| Found: ("" : String)
| Required: Test.M[Test.Inv[Int] & Test.Inv[String]]
|
| Note: a match type could not be fully reduced:
|
| trying to reduce Test.M[Test.Inv[Int] & Test.Inv[String]]
| failed since selector Test.Inv[Int] & Test.Inv[String]
| is uninhabited (there are no values of that type).
|
| longer explanation available when compiling with `-explain`
-- [E007] Type Mismatch Error: tests/neg/6571.scala:7:39 ---------------------------------------------------------------
7 | def bar: M[Inv[String] & Inv[Int]] = 0 // error
| ^
| Found: (0 : Int)
| Required: Test.M[Test.Inv[String] & Test.Inv[Int]]
|
| Note: a match type could not be fully reduced:
|
| trying to reduce Test.M[Test.Inv[String] & Test.Inv[Int]]
| failed since selector Test.Inv[String] & Test.Inv[Int]
| is uninhabited (there are no values of that type).
|
| longer explanation available when compiling with `-explain`
8 changes: 8 additions & 0 deletions tests/neg/6571.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
object Test {
class Inv[T]
type M[t] = t match {
case Inv[u] => u
}
def foo: M[Inv[Int] & Inv[String]] = "" // error
def bar: M[Inv[String] & Inv[Int]] = 0 // error
}

0 comments on commit 133cb46

Please sign in to comment.