diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2008-08-08 16:39:26 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2008-08-08 16:39:26 +0000 |
commit | a15a44cdd13bd947aba08031aa753b4244604522 (patch) | |
tree | 4fe71f2fdff2fbcf0c7a2e1d9fb80ba136ae5211 /src | |
parent | b7e61584f63482e741a4706dbcadc363df88b844 (diff) | |
download | scala-a15a44cdd13bd947aba08031aa753b4244604522.tar.gz scala-a15a44cdd13bd947aba08031aa753b4244604522.tar.bz2 scala-a15a44cdd13bd947aba08031aa753b4244604522.zip |
Fixed #1123
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/GenICode.scala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 83f509c13f..811efc410b 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -493,7 +493,8 @@ abstract class GenICode extends SubComponent { ctx1.cleanups = oldcleanups if (saved) ctx1.bb.emit(LOAD_LOCAL(tmp)) - ctx1.bb.emit(RETURN(returnedKind), tree.pos) + adapt(returnedKind, ctx.method.returnType, ctx, tree.pos) + ctx1.bb.emit(RETURN(ctx.method.returnType), tree.pos) ctx1.bb.enterIgnoreMode generatedType = expectedType ctx1 @@ -1015,25 +1016,24 @@ abstract class GenICode extends SubComponent { // emit conversion if (generatedType != expectedType) - adapt(generatedType, expectedType, resCtx, tree); + adapt(generatedType, expectedType, resCtx, tree.pos); resCtx } - private def adapt(from: TypeKind, to: TypeKind, ctx: Context, tree: Tree): Unit = { + private def adapt(from: TypeKind, to: TypeKind, ctx: Context, pos: Position): Unit = { if (!(from <:< to) && !(from == SCALA_ALLREF && to == SCALA_ALL)) { to match { case UNIT => - ctx.bb.emit(DROP(from), tree.pos) + ctx.bb.emit(DROP(from), pos) if (settings.debug.value) log("Dropped an " + from); case _ => if (settings.debug.value) - assert(from != UNIT, "Can't convert from UNIT to " + to + - tree + " at: " + (tree.pos)) + assert(from != UNIT, "Can't convert from UNIT to " + to + " at: " + pos) assert(!from.isReferenceType && !to.isReferenceType, "type error: can't convert from " + from + " to " + to +" in unit "+this.unit) - ctx.bb.emit(CALL_PRIMITIVE(Conversion(from, to)), tree.pos); + ctx.bb.emit(CALL_PRIMITIVE(Conversion(from, to)), pos); } } else if (from == SCALA_ALL) { ctx.bb.emit(DROP(from)) |