trait Element[+A] {
type T = A
}
// Error: covariant type A occurs in invariant
// position in type A of type T type T = A
为什么不允许在类型成员中使用协变类型参数?
此问题有一个answer,但说明未涵盖问题“为什么”足够好。如果有一些示例可以在运行时中断类型系统,那将是很好的。
编辑:
我发现这种限制存在很长的历史:
SI-7093-受保护的[this]方差转义阴影不正确