summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-02-20 15:52:56 -0800
committerJames Iry <jamesiry@gmail.com>2013-02-26 09:44:29 -0800
commit208d6ad0bbbb4f7b5021f96bce14606869a6c899 (patch)
tree5def9d3ebb3b449c5b8a3d6ad1874da70574ae8d /src/compiler
parenta340dd61c7320754bf4c12535c5daccbdea9492c (diff)
downloadscala-208d6ad0bbbb4f7b5021f96bce14606869a6c899.tar.gz
scala-208d6ad0bbbb4f7b5021f96bce14606869a6c899.tar.bz2
scala-208d6ad0bbbb4f7b5021f96bce14606869a6c899.zip
SI-7159 Remove unreachable cases in GenICode#adapt
This commit removes some unreachable code in GenICode#adapt. It's hard to prove that these cases are unreachable, but they do appear to be and I wasn't able to find a way to get to them. Code archaeology was un-fruitful; they're very old. Which may mean they are legacies from a time when Null and Nothing types weren't fully baked.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 122972039b..3167289a10 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -1038,7 +1038,7 @@ abstract class GenICode extends SubComponent {
// A typical example is an overloaded type assigned after typer.
log(s"GenICode#adapt($from, $to, $ctx, $pos)")
- val conforms = (from <:< to) || (from == NullReference && to == NothingReference) // TODO why would we have null where we expect nothing?
+ val conforms = (from <:< to)
def coerce(from: TypeKind, to: TypeKind) = ctx.bb.emit(CALL_PRIMITIVE(Conversion(from, to)), pos)
def checkAssertions() {
def msg = s"Can't convert from $from to $to in unit ${unit.source} at $pos"
@@ -1054,8 +1054,6 @@ abstract class GenICode extends SubComponent {
// 6: athrow
// So this case tacks on the ahtrow which makes the JVM happy because class Nothing is declared as a subclass of Throwable
case NothingReference => ctx.bb.emit(THROW(ThrowableClass)) ; ctx.bb.enterIgnoreMode()
- // TODO why do we have this case? It's saying if we have a throwable and a non-throwable is expected then we should emit a cast? Why would we get here?
- case ThrowableReference if !(ThrowableClass.tpe <:< to.toType) => ctx.bb.emit(CHECK_CAST(to)) // downcast throwables
case _ =>
// widen subrange types
if (from.isIntSizedType && to == LONG)