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.
Merge pull request #15 from scala/backport-lts-3.3-21718
Backport "Always interpret underscores inside patterns as type bounds" to LTS
- Loading branch information
Showing
4 changed files
with
37 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//> using options -Ykind-projector:underscores | ||
|
||
import Tuple.* | ||
|
||
type LiftP[F[_], T] <: Tuple = | ||
T match { | ||
case _ *: _ => F[Head[T]] *: LiftP[F, Tail[T]] | ||
case _ => EmptyTuple | ||
} |
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,7 @@ | ||
//> using options -Ykind-projector:underscores | ||
|
||
import scala.compiletime.ops.int.S | ||
|
||
type IndexOf[T <: Tuple, E] <: Int = T match | ||
case E *: _ => 0 | ||
case _ *: es => 1 // S[IndexOf[es, E]] |
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,10 @@ | ||
//> using options -Ykind-projector:underscores | ||
|
||
import scala.quoted.Type | ||
import scala.quoted.Quotes | ||
|
||
def x[A](t: Type[A])(using Quotes): Boolean = t match | ||
case '[_ *: _] => | ||
true | ||
case _ => | ||
false |