Skip to content

Commit 6eeb8c6

Browse files
committed
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.
1 parent 06d278b commit 6eeb8c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/dotty/tools/dotc/transform/Erasure.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ object Erasure extends TypeTestsCasts{
195195
// See SI-2386 for one example of when this might be necessary.
196196
cast(ref(defn.runtimeMethod(nme.toObjectArray)).appliedTo(tree), pt)
197197
case _ =>
198-
ctx.log(s"casting from ${tree.showSummary}: ${tree.tpe.show} to ${pt.show}")
199-
tree.asInstance(pt)
198+
if (pt.isPrimitiveValueType) primitiveConversion(tree, pt.classSymbol)
199+
else tree.asInstance(pt)
200200
}
201201
}
202202

0 commit comments

Comments
 (0)