-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The overall goal was to have a more uniform treatment of `tryNormalize` rather than the three overrides, making the logic easier to follow. It also now reuses `underlyingMatchType` for it, which not only has a caching benefit but also ensures consistent results between them. In particular, making `tryNormalize.exists` imply `underlyingMatchType.exists`, which one might assume as true but did not hold in general previously.
- Loading branch information
Showing
8 changed files
with
96 additions
and
69 deletions.
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
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,14 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/i12049d.scala:14:52 ----------------------------------------------------------- | ||
14 |val x: M[NotRelevant[Nothing], Relevant[Nothing]] = 2 // error | ||
| ^ | ||
| Found: (2 : Int) | ||
| Required: M[NotRelevant[Nothing], Relevant[Nothing]] | ||
| | ||
| Note: a match type could not be fully reduced: | ||
| | ||
| trying to reduce M[NotRelevant[Nothing], Relevant[Nothing]] | ||
| trying to reduce Relevant[Nothing] | ||
| failed since selector Nothing | ||
| is uninhabited (there are no values of that type). | ||
| | ||
| 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,14 @@ | ||
|
||
trait A | ||
trait B | ||
|
||
type M[X, Y] = Y match | ||
case A => Int | ||
case B => String | ||
|
||
type Relevant[Z] = Z match | ||
case A => B | ||
type NotRelevant[Z] = Z match | ||
case B => A | ||
|
||
val x: M[NotRelevant[Nothing], Relevant[Nothing]] = 2 // error |
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,16 @@ | ||
trait WrapperType[A] | ||
|
||
case class Foo[A]() | ||
|
||
case class Bar[A]() | ||
|
||
type FooToBar[D[_]] = [A] =>> D[Unit] match { | ||
case Foo[Unit] => Bar[A] | ||
} | ||
|
||
case class Test() | ||
object Test { | ||
implicit val wrapperType: WrapperType[Bar[Test]] = new WrapperType[Bar[Test]] {} | ||
} | ||
|
||
val test = summon[WrapperType[FooToBar[Foo][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,8 @@ | ||
|
||
type Rec[X] = X match | ||
case Int => Rec[X] | ||
|
||
type M[Unused, Y] = Y match | ||
case String => Double | ||
|
||
def foo[X](d: M[Rec[X], "hi"]) = ??? |
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,2 @@ | ||
|
||
def Test = foo[Int](3d) // crash before changes |