Closed
Description
enum Expr[A] {
case BoolLit(b: Boolean) extends Expr[Boolean]
def eval: A = {
def go[AA](self: this.type & Expr[AA]): A = self match {
case BoolLit(b) => b
}
go(this)
}
}
Error message:
|Pattern type Expr.BoolLit[A] is neither a subtype nor a supertype of selector type Expr'[A'](Expr'.this) & Expr'[AA]
|
|where: A is a type variable
| A' is a type in class Expr
| Expr is a object
| Expr' is a class
Motivation for why someone would want to do this: it could allow "indirectly" constraining type parameters of enclosing class.