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.
Fix scala#9675: Type _ in MT patterns with correct kind
- Loading branch information
1 parent
03c2cb1
commit 057af51
Showing
2 changed files
with
19 additions
and
2 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,18 @@ | ||
import scala.compiletime.S | ||
|
||
sealed trait TList | ||
sealed trait TNil extends TList | ||
sealed trait ++:[H[_], T <: TList] extends TList | ||
|
||
type IndexOf[H[_], T <: TList] <: Int = T match | ||
case H ++: _ => 0 | ||
case _ ++: t => S[IndexOf[H, t]] | ||
|
||
// compiles fine | ||
val a = summon[ValueOf[IndexOf[List, List ++: Option ++: TNil]]].value | ||
|
||
// causes an error | ||
val b = summon[ValueOf[IndexOf[List, Option ++: List ++: TNil]]].value | ||
|
||
object T extends App: | ||
println(a) |