-
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.
Merge pull request #13262 from dotty-staging/fix-9675
Fix #9675: Type _ in MT patterns with correct kind
- Loading branch information
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.ops.int.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) |