summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala5
-rw-r--r--test/files/run/promotion.check6
-rw-r--r--test/files/run/promotion.scala12
3 files changed, 13 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 78ae4d6cb0..b1e2912e33 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -647,9 +647,8 @@ abstract class GenICode extends SubComponent {
if (settings.debug.value)
log("UNBOX : " + fun.symbol.fullNameString)
val ctx1 = genLoad(expr, ctx, toTypeKind(expr.tpe))
- val boxType = fun.symbol.owner.linkedClassOfClass.tpe
- ctx1.bb.emit(UNBOX(boxType), expr.pos)
- generatedType = toTypeKind(boxType)
+ assert(expectedType.isValueType)
+ ctx1.bb.emit(UNBOX(expectedType.toType), expr.pos)
ctx1
case Apply(fun, args) =>
diff --git a/test/files/run/promotion.check b/test/files/run/promotion.check
index 59d4f84f5f..e769775ce7 100644
--- a/test/files/run/promotion.check
+++ b/test/files/run/promotion.check
@@ -1,2 +1,4 @@
-B
-List(2.0)
+2.0
+6.0
+20.0
+30.0
diff --git a/test/files/run/promotion.scala b/test/files/run/promotion.scala
index 82b5265143..6e000c7f00 100644
--- a/test/files/run/promotion.scala
+++ b/test/files/run/promotion.scala
@@ -3,10 +3,12 @@
* Was bug 891.
*/
object Test {
- def main(args:Array[String]):Unit = {
- Console println
- List(Pair(1,2.0)).map[double]({ x => x match {
- case Pair(a, x) => Console.println("B"); x * a
- }});
+
+ def id[A](x: A): A = x;
+ def main(args: Array[String]): Unit = {
+ Console.println(id(1) * 2.0)
+ Console.println(3.0 * id(2))
+ Console.println(id(4.0) * 5)
+ Console.println(6 * id(5.0))
}
}