diff options
author | Martin Odersky <odersky@gmail.com> | 2014-10-17 12:18:01 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-10-17 12:18:01 +0200 |
commit | 6eeb8c61a9b9aff6119977b09adebcfcc622c041 (patch) | |
tree | beb0cc596ea9b92a25a23d7e8f8ae725bfbfd959 | |
parent | 06d278bcbf6237c884bde0691536d28fbdb2e593 (diff) | |
download | dotty-6eeb8c61a9b9aff6119977b09adebcfcc622c041.tar.gz dotty-6eeb8c61a9b9aff6119977b09adebcfcc622c041.tar.bz2 dotty-6eeb8c61a9b9aff6119977b09adebcfcc622c041.zip |
Erasure casting should perform primitive conversions
After erasure, asInstanceworks only bedtween reference types, so erasure
is not allowed to insert asInstanceOfs between numeric types. Previously
this made t1260 fail even if LambdaLift is disabled.
-rw-r--r-- | src/dotty/tools/dotc/transform/Erasure.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/transform/Erasure.scala b/src/dotty/tools/dotc/transform/Erasure.scala index 0e1b389ff..ed853f8f1 100644 --- a/src/dotty/tools/dotc/transform/Erasure.scala +++ b/src/dotty/tools/dotc/transform/Erasure.scala @@ -195,8 +195,8 @@ object Erasure extends TypeTestsCasts{ // See SI-2386 for one example of when this might be necessary. cast(ref(defn.runtimeMethod(nme.toObjectArray)).appliedTo(tree), pt) case _ => - ctx.log(s"casting from ${tree.showSummary}: ${tree.tpe.show} to ${pt.show}") - tree.asInstance(pt) + if (pt.isPrimitiveValueType) primitiveConversion(tree, pt.classSymbol) + else tree.asInstance(pt) } } |