Closed
Description
Minimized code
package asts
enum Ast[-T >: Null]:
case DefDef()
trait AstImpl[T >: Null]:
type Ast = asts.Ast[T]
type DefDef = Ast.DefDef[T]
end AstImpl
object untpd extends AstImpl[Null]:
def DefDef(ast: Ast): DefDef = ast match
case ast: DefDef => ast
end untpd
Output
-- Warning: Ast.scala:24:9 -----------------------------------------------------
24 | case ast: DefDef => ast
| ^^^^^^^^^^^
| the type test for asts.untpd.DefDef cannot be checked at runtime
1 warning found
Expectation
compile as in 0.24.0-RC1
Notes
if we instead explicitly copy the variance from the parent to the case, then the warning goes away:
enum Ast[-T >: Untyped]:
// case DefDef()
case DefDef[-T >: Untyped]() extends Ast[T]