-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Minimized code
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)Output
[error] 45 |val b = summon[ValueOf[IndexOf[List, Option ++: List ++: TNil]]].value
[error] | ^
[error] |No singleton value available for IndexOf[List, Option ++: List ++: TNil].Expectation
Note that if ++: is defined for a non-higher-kinded types (e.g. sealed trait ++:[H, T <: TList] extends TList) both of this cases compiles.