Skip to content

Fix #6571: Add regression test #14868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}