Closed
Description
Hello 👋 I copied Match types example from the docs into Scastie, but it didn't compile.
Compiler version
3.0.0-M3
Minimized code
type LeafElem[X] = X match
case String => Char
case Array[t] => LeafElem[t]
case Iterable[t] => LeafElem[t]
case AnyVal => X
def leafElem[X](x: X): LeafElem[X] = x match
case x: String => x.charAt(0)
case x: Array[t] => leafElem(x(9))
// case x: Iterable[t] => leafElem(x.next())
case x: AnyVal => x
Output
Found: Char
Required: LeafElem[X]
where: X is a type in method leafElem with bounds >: (?1 : String)
Found: t
Required: X
where: X is a type in method leafElem with bounds >: (?2 : Array[t])
Found: (x : X & AnyVal)
Required: LeafElem[X]
where: X is a type in method leafElem with bounds >: (?3 : AnyVal)
Expectation
Code should compile