diff options
author | Som Snytt <som.snytt@gmail.com> | 2016-10-07 19:55:21 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2016-10-07 19:55:21 -0700 |
commit | a7a4e5f68c070543516aed3e4ad3e3d6c787dce1 (patch) | |
tree | a7c01437df3ddc576edf72b4966cac2d78b9630c /src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | |
parent | 9d3f0777ff883a7c59da3fa7fee156890f51701e (diff) | |
download | scala-a7a4e5f68c070543516aed3e4ad3e3d6c787dce1.tar.gz scala-a7a4e5f68c070543516aed3e4ad3e3d6c787dce1.tar.bz2 scala-a7a4e5f68c070543516aed3e4ad3e3d6c787dce1.zip |
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.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 2 |
1 files changed, 1 insertions, 1 deletions
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; |