forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…a#19511) Previously, for a `BaseTypeTest`, we explicitly checked the prefix of the type constructor for `=:=`. This is however too strict, as shown by scala#19445. We remove the test entirely, as the correct subprefixing test is already part of the overall `scrut <:< instantiatedPat` done at the end.
- Loading branch information
Showing
4 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/i19445.scala:17:15 ------------------------------------------------------------ | ||
17 | val x: Int = ??? : UnwrapTypes[FooBar.Bar[Int]] // error | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| Found: Test.UnwrapTypes[FooBar.Bar[Int]] | ||
| Required: Int | ||
| | ||
| Note: a match type could not be fully reduced: | ||
| | ||
| trying to reduce Test.UnwrapTypes[FooBar.Bar[Int]] | ||
| failed since selector FooBar.Bar[Int] | ||
| does not match case BarFoo.Bar[x] => Test.UnwrapTypes[x] | ||
| and cannot be shown to be disjoint from it either. | ||
| Therefore, reduction cannot advance to the remaining cases | ||
| | ||
| case String => String | ||
| case Int => Int | ||
| | ||
| longer explanation available when compiling with `-explain` | ||
-- [E007] Type Mismatch Error: tests/neg/i19445.scala:18:28 ------------------------------------------------------------ | ||
18 | val tup: (Int, String) = ??? : UnwrapTypes[(FooBar.Bar[Int], FooBar.Bar[String])] // error | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| Found: (Test.UnwrapTypes[FooBar.Bar[Int]], Test.UnwrapTypes[FooBar.Bar[String]]) | ||
| Required: (Int, String) | ||
| | ||
| Note: a match type could not be fully reduced: | ||
| | ||
| trying to reduce Test.UnwrapTypes[FooBar.Bar[Int]] | ||
| failed since selector FooBar.Bar[Int] | ||
| does not match case BarFoo.Bar[x] => Test.UnwrapTypes[x] | ||
| and cannot be shown to be disjoint from it either. | ||
| Therefore, reduction cannot advance to the remaining cases | ||
| | ||
| case String => String | ||
| case Int => Int | ||
| | ||
| longer explanation available when compiling with `-explain` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
trait Foo: | ||
case class Bar[A](value: A) | ||
|
||
object FooBar extends Foo | ||
|
||
object BarFoo extends Foo | ||
|
||
object Test: | ||
type UnwrapTypes[Xs] = | ||
Xs match | ||
case EmptyTuple => Xs | ||
case x *: xs => UnwrapTypes[x] *: UnwrapTypes[xs] | ||
case BarFoo.Bar[x] => UnwrapTypes[x] | ||
case String => String | ||
case Int => Int | ||
|
||
val x: Int = ??? : UnwrapTypes[FooBar.Bar[Int]] // error | ||
val tup: (Int, String) = ??? : UnwrapTypes[(FooBar.Bar[Int], FooBar.Bar[String])] // error | ||
end Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
trait Foo: | ||
case class Bar[A](value: A) | ||
|
||
object FooBar extends Foo | ||
|
||
object Test: | ||
type UnwrapTypes[Xs] = | ||
Xs match | ||
case EmptyTuple => Xs | ||
case x *: xs => UnwrapTypes[x] *: UnwrapTypes[xs] | ||
case Foo#Bar[x] => UnwrapTypes[x] | ||
case String => String | ||
case Int => Int | ||
|
||
val x: Int = ??? : UnwrapTypes[FooBar.Bar[Int]] | ||
val tup: (Int, String) = ??? : UnwrapTypes[(FooBar.Bar[Int], FooBar.Bar[String])] | ||
end Test |