diff options
author | Martin Odersky <odersky@gmail.com> | 2010-05-19 22:10:39 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2010-05-19 22:10:39 +0000 |
commit | 50bf167d084b78e4c0f4b906ad0587cd29b533dc (patch) | |
tree | 00e37715270c556f3504fc4751d13f8f81ad1c66 /src/compiler | |
parent | f139afb941513aa41bf077b4aa2391443ad4db46 (diff) | |
download | scala-50bf167d084b78e4c0f4b906ad0587cd29b533dc.tar.gz scala-50bf167d084b78e4c0f4b906ad0587cd29b533dc.tar.bz2 scala-50bf167d084b78e4c0f4b906ad0587cd29b533dc.zip |
Closes #3304. Review by extempore.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/UnCurry.scala | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 38c675b5e9..0270323133 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -403,8 +403,15 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { Select(predef, "wrap"+elemtp.typeSymbol.name+"Array") else TypeApply(Select(predef, "genericWrapArray"), List(TypeTree(elemtp))) - val adaptedTree = // need to cast to Array[elemtp], as arrays are not covariant - gen.mkCast(tree, arrayType(elemtp)) + val pt = arrayType(elemtp) + val adaptedTree = // might need to cast to Array[elemtp], as arrays are not covariant + if (tree.tpe <:< pt) tree + else gen.mkCast( + if (elemtp.typeSymbol == AnyClass && isValueClass(tree.tpe.typeArgs.head.typeSymbol)) + gen.mkRuntimeCall("toObjectArray", List(tree)) + else + tree, + arrayType(elemtp)) Apply(meth, List(adaptedTree)) } } |