From a7a4e5f68c070543516aed3e4ad3e3d6c787dce1 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Fri, 7 Oct 2016 19:55:21 -0700 Subject: SI-9953 Any Any aborts warn on equals Don't warn about equals if any `Any` is involved. cf SI-8965 The condition for warning is that both types lub to a supertype of Object. --- src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala') diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 106b076eef..34cdfcdd39 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -1103,7 +1103,7 @@ abstract class RefChecks extends Transform { // better to have lubbed and lost def warnIfLubless(): Unit = { val common = global.lub(List(actual.tpe, receiver.tpe)) - if (ObjectTpe <:< common && !(ObjectTpe <:< actual.tpe && ObjectTpe <:< receiver.tpe)) + if (ObjectTpe <:< common && !(ObjectTpe <:< actual.tpe) && !(ObjectTpe <:< receiver.tpe)) unrelatedTypes() } // warn if actual has a case parent that is not same as receiver's; -- cgit v1.2.3