有谁知道这个编译器错误是怎么回事?如果我不扩展 INode,错误就会消失。
trait AbsTypes
{
type TKey
type TValue
}
trait INode extends AbsTypes
{
def get(key : TKey) : TValue
def set(key : TKey, v : TValue) : INode
}
class ANode[TKey,TValue](
val akey : TKey,
val aval : TValue
) extends INode
{
// ERROR : type mismatch; found : ANode.this.aval.type (with underlying type TValue) required: ANode.this.TValue
def get(key : TKey) : TValue = { aval }
def set(key : TKey, v : TValue) : INode = {
new ANode(key,v)
}
}