Open
Description
Compiler version
3.5.1-RC1-bin-20240602-c6fbe6f-NIGHTLY
Minimized code
This is a variation of @EugeneFlesselle's #19746:
trait V:
type X = this.type match
case W[x] => x
class W[+Y] extends V
trait Outer[+T]:
val t: T
object Test:
extension (self: Any) def as[T]: T =
def asX(o: Outer[W[Any]]): o.t.X /* <- reduces to Any */ = self
asX(new Outer[W[T]] { val t = W[T]() }) /* <- reduces to T */
@main def run =
0.as[Boolean] // ClassCastException
The fix for #19746 in 0a3497b should be generalized to check is(Param)
in prefixes too (and maybe that should also apply to TypeRef and not just TermRef).