summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-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 _ =>
}