forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make aliases of
MatchAlias
es normal TypeAlias
es
Make `isMatch` false for applied `MatchAlias`es, i.e. true only for `MatchType`s and higher-kinded abstraction of them. As a result, code using `isMatch` to choose between a `TypeAlias` and `MatchAlias` will now use a `TypeAlias` when aliasing a `MatchAlias`. Which in turn allows for better de-aliasing, since `dealias` only de-aliases standard type aliases. The logic for this distinction has also been extracted to the common `AliasingBounds` supertype. `tryNormalize` on `AppliedType`s should only attempt reduction if there is an underlying match type. This could previously be identified by a `MatchAlias` tycon. We now need a recursive check.
- Loading branch information
1 parent
90c3fbd
commit ef7db7a
Showing
9 changed files
with
70 additions
and
26 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
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 was deleted.
Oops, something went wrong.
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,7 +1,17 @@ | ||
import scala.quoted._ | ||
import scala.deriving._ | ||
|
||
def blah2[P <: Product, MEL <: Tuple: Type, MET <: Tuple: Type](m: Mirror.ProductOf[P] { type MirroredElemLabels = MEL; type MirroredElemTypes = MET})(using Quotes) = { | ||
def blah[P <: Product] | ||
(m: Mirror.ProductOf[P]) | ||
(using Quotes, Type[m.MirroredElemLabels], Type[m.MirroredElemTypes]) = { | ||
type z = Tuple.Zip[m.MirroredElemLabels, m.MirroredElemTypes] | ||
Type.of[z] // error | ||
() | ||
} | ||
|
||
def blah2[P <: Product, MEL <: Tuple: Type, MET <: Tuple: Type] | ||
(m: Mirror.ProductOf[P] { type MirroredElemLabels = MEL; type MirroredElemTypes = MET}) | ||
(using Quotes) = { | ||
Type.of[Tuple.Zip[MEL, MET]] | ||
() | ||
} |
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,26 @@ | ||
|
||
object Test: | ||
|
||
trait T: | ||
type S | ||
type F = T.F[S] | ||
|
||
def foo: F | ||
def bar: T.F[S] | ||
|
||
object T: | ||
type F[X] = X match | ||
case String => Option[Int] | ||
|
||
type G[X] = X match | ||
case Option[x] => Int | ||
|
||
val t: T {type S = String} = ??? | ||
|
||
val b = t.bar | ||
val m1: T.G[b.type] = ??? | ||
val _: Int = m1 // Ok | ||
|
||
val f = t.foo | ||
val m: T.G[f.type] = ??? | ||
val _: Int = m // Error before changes |