Unbound wildcard type in Scala 3.1.2

The code below use “?” to do the wildcard match in type match and value match, but in Scala 3.1.2, the compiler complains “Unbound wildcard type”.

What is the syntax for the wildcard match in the type match and the value match against the singleton type?

type InputValue = Singleton & Int
...
type DepType [T <: InputValue] = T match
    ...
    case ? => B[Boolean]  // red mark under '?', the tip is "Unbound wildcard type bloop"

object DepFunction:
  def apply[N <: InputValue](x: N): DepType[x.type] = 
    x match
      case 0 : 0 => b0
      case 1 : 1 => b1
      case _ : ? => b2 // red mark under '?', the tip is "Unbound wildcard type bloop"

Thanks for your help!

Guofeng

Just remove the wildcard (whether a _ or a ?).

HTHs

That does not work.

But if I replace “case ?” with “case AnyVal”, and “case _ : ?” by “case _ : AnyVal”, it works now,

Thanks.

Did you remove the colon too?

object DepFunction:
  def apply[N <: InputValue](x: N): DepType[x.type] = 
    x match
      case 0 : 0 => b0
      case 1 : 1 => b1
      case _  => b2 // red mark under '?', the tip is "Unbound wildcard type bloop"