提交 ef825a75 编写于 作者: M Mikhael Bogdanov

Fix for KT-14868: CCE in runtime while converting Number to Char

 #KT-14868 Fixed
上级 ce333b0a
......@@ -405,11 +405,12 @@ public abstract class StackValue {
coerce(unboxedType, toType, v);
}
else {
if (toType.getSort() == Type.BOOLEAN || toType.getSort() == Type.CHAR) {
Type numberType = getType(Number.class);
if (toType.getSort() == Type.BOOLEAN || (toType.getSort() == Type.CHAR && !numberType.equals(fromType))) {
coerce(fromType, boxType(toType), v);
}
else {
coerce(fromType, getType(Number.class), v);
coerce(fromType, numberType, v);
}
unbox(toType, v);
}
......
fun box(): String {
val x: Number = 75
return "O" + x.toChar()
}
\ No newline at end of file
public final class Kt14868Kt {
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
......@@ -10958,6 +10958,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
doTest(fileName);
}
@TestMetadata("kt14868.kt")
public void testKt14868() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/primitiveTypes/kt14868.kt");
doTest(fileName);
}
@TestMetadata("kt1508.kt")
public void testKt1508() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/primitiveTypes/kt1508.kt");
......
......@@ -10958,6 +10958,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("kt14868.kt")
public void testKt14868() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/primitiveTypes/kt14868.kt");
doTest(fileName);
}
@TestMetadata("kt1508.kt")
public void testKt1508() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/primitiveTypes/kt1508.kt");
......
......@@ -10958,6 +10958,12 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis
doTest(fileName);
}
@TestMetadata("kt14868.kt")
public void testKt14868() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/primitiveTypes/kt14868.kt");
doTest(fileName);
}
@TestMetadata("kt1508.kt")
public void testKt1508() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/primitiveTypes/kt1508.kt");
......
......@@ -12849,6 +12849,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
doTest(fileName);
}
@TestMetadata("kt14868.kt")
public void testKt14868() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/primitiveTypes/kt14868.kt");
doTest(fileName);
}
@TestMetadata("kt1508.kt")
public void testKt1508() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/primitiveTypes/kt1508.kt");
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册