-
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.
Enable betterMatchTypeExtractors in >= 3.6
- Loading branch information
Showing
7 changed files
with
58 additions
and
14 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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
//> using options -language:experimental.betterMatchTypeExtractors | ||
|
||
trait Expr: | ||
type Value | ||
object Expr: | ||
|
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,32 @@ | ||
trait Column: | ||
type T | ||
type F[X] | ||
type Q = F[T] | ||
|
||
class varchar extends Column: | ||
type T = String | ||
|
||
trait notnull extends Column: | ||
type F[X] = X | ||
|
||
object Error: | ||
|
||
val firstName = new varchar with notnull | ||
val lastName = new varchar with notnull | ||
|
||
val relation = (firstName, lastName) | ||
|
||
type RelationTypes = Tuple.InverseMap[relation.type, [X] =>> Column { type Q = X }] | ||
|
||
summon[RelationTypes =:= (String, String)] | ||
|
||
object Works: | ||
|
||
object firstName extends varchar with notnull | ||
object lastName extends varchar with notnull | ||
|
||
val relation = (firstName, lastName) | ||
|
||
type RelationTypes = Tuple.InverseMap[relation.type, [X] =>> Column { type Q = X }] | ||
|
||
summon[RelationTypes =:= (String, String)] |
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 A: | ||
type T | ||
type U = T | ||
|
||
trait B extends A: | ||
type T = String | ||
|
||
object C extends B | ||
|
||
|
||
type F[X] = A { type U = X } // works when `U` is replaced with `T` | ||
|
||
type InvF[Y] = Y match | ||
case F[x] => x | ||
|
||
|
||
object Test: | ||
summon[InvF[C.type] =:= String] // ok | ||
summon[InvF[B] =:= String] // error: selector B does not uniquely determine parameter x |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
//> using options -language:experimental.betterMatchTypeExtractors | ||
|
||
trait Expr: | ||
type Value | ||
|
||
|