有没有办法约束一个方法,以便只有在两种类型被证明不相等时才有意义?
trait Something[A, B] {
// I can only be called if type A is the same as type B
def ifEqual(implicit ev: A =:= B)
// Now I cannot be called if type A is proven to be the same as type B
def ifNotEqual(implicit ev: A ??? B)
}