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.
Allow SAM types to contain match alias refinements (scala#20092)
Fixes scala#20080
- Loading branch information
Showing
2 changed files
with
33 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,32 @@ | ||
|
||
trait Zippable[-A, -B]: | ||
type Out | ||
def zip(left: A, right: B): Out | ||
|
||
object Zippable extends ZippableLowPrio: | ||
given append[A <: Tuple, B]: (Zippable[A, B] { type Out = Tuple.Append[A, B] }) = | ||
(left, right) => left :* right | ||
|
||
trait ZippableLowPrio: | ||
given pair[A, B]: (Zippable[A, B] { type Out = (A, B) }) = | ||
(left, right) => (left, right) | ||
|
||
|
||
object Minimization: | ||
|
||
trait Fun1: | ||
type Out | ||
def apply(x: Any): Out | ||
|
||
type M[X] = X match | ||
case String => X | ||
|
||
def test[A] = | ||
|
||
val _: Fun1 { type Out = M[A] } = new Fun1: | ||
type Out = M[A] | ||
def apply(x: Any): Out = ??? | ||
|
||
val _: Fun1 { type Out = M[A] } = x => ??? | ||
|
||
val _: Fun1 { type Out = A match {case String => A} } = x => ??? |