File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed
src/compiler/scala/tools/nsc/typechecker Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1095,7 +1095,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
1095
1095
// better to have lubbed and lost
1096
1096
def warnIfLubless (): Unit = {
1097
1097
val common = global.lub(List (actual.tpe, receiver.tpe))
1098
- if (ObjectTpe <:< common)
1098
+ if (ObjectTpe <:< common && ! ( ObjectTpe <:< actual.tpe && ObjectTpe <:< receiver.tpe) )
1099
1099
unrelatedTypes()
1100
1100
}
1101
1101
// warn if actual has a case parent that is not same as receiver's;
Original file line number Diff line number Diff line change
1
+ -Xfatal-warnings
Original file line number Diff line number Diff line change
1
+ class A {
2
+ def f (x : Any with AnyRef , y : Any with AnyRef ) = x eq y
3
+ // a.scala:2: warning: Any and Any are unrelated: they will most likely never compare equal
4
+ // def f(x: Any with AnyRef, y: Any with AnyRef) = x eq y
5
+ // ^
6
+ // one warning found
7
+ }
You can’t perform that action at this time.
0 commit comments