summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-09-10 00:34:48 +0000
committerPaul Phillips <paulp@improving.org>2011-09-10 00:34:48 +0000
commitb2b068133a68eb05001c6a233ede5af9e473f796 (patch)
tree10e6f5c00f819f6b9c77b18df10f96e74bb99d70
parent9a40a521b2bed38bd3257e0ad45f9cb1099936ff (diff)
downloadscala-b2b068133a68eb05001c6a233ede5af9e473f796.tar.gz
scala-b2b068133a68eb05001c6a233ede5af9e473f796.tar.bz2
scala-b2b068133a68eb05001c6a233ede5af9e473f796.zip
Improvement of incompatible == warning.
Didn't notice that ScalaObject would sometimes be the lub rather than Object, no review.
-rw-r--r--src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala7
2 files changed, 6 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
index 2f49b3b747..cb77df2e6a 100644
--- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
+++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
@@ -1263,7 +1263,7 @@ abstract class GenMSIL extends SubComponent {
i += 1
}
val defaultTarget = labels(branches(i))
- if (next != defaultTarget)
+ if (next != branches(i))
mcode.Emit(OpCodes.Br, defaultTarget)
case JUMP(whereto) =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 1b28027bb1..929f3cc6ad 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -1054,8 +1054,11 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R
if (actual isSubClass receiver) ()
else if (receiver isSubClass actual) ()
// warn only if they have no common supertype below Object
- else if (ObjectClass.tpe <:< global.lub(List(actual.tpe, receiver.tpe)))
- unrelatedTypes()
+ else {
+ val common = global.lub(List(actual.tpe, receiver.tpe))
+ if (common.typeSymbol == ScalaObjectClass || (ObjectClass.tpe <:< common))
+ unrelatedTypes()
+ }
}
case _ =>
}