[JVM_IR] Recursively perform constant lowering.
Otherwise constants in child expressions are not transformed. ^KT-47716 Fixed.
This commit is contained in:
committed by
Alexander Udalov
parent
2877f1cabe
commit
6436a1686d
+6
@@ -42460,6 +42460,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47716.kt")
|
||||||
|
public void testKt47716() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt47716.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
||||||
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class ConstLowering(val context: JvmBackendContext) : IrElementTransformerVoid()
|
|||||||
|
|
||||||
private fun IrExpression.lowerConstRead(receiver: IrExpression?, field: IrField?): IrExpression? {
|
private fun IrExpression.lowerConstRead(receiver: IrExpression?, field: IrField?): IrExpression? {
|
||||||
val value = field?.constantValue() ?: return null
|
val value = field?.constantValue() ?: return null
|
||||||
|
transformChildrenVoid()
|
||||||
val resultExpression = if (context.state.shouldInlineConstVals)
|
val resultExpression = if (context.state.shouldInlineConstVals)
|
||||||
value.copyWithOffsets(startOffset, endOffset)
|
value.copyWithOffsets(startOffset, endOffset)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// IGNORE_BACKEND: WASM
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val r =
|
||||||
|
try {
|
||||||
|
ULong
|
||||||
|
} finally {
|
||||||
|
UInt.MAX_VALUE
|
||||||
|
}.MAX_VALUE
|
||||||
|
return if (r == ULong.MAX_VALUE) "OK" else "FAIL"
|
||||||
|
}
|
||||||
+6
@@ -42418,6 +42418,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47716.kt")
|
||||||
|
public void testKt47716() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt47716.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
||||||
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
||||||
|
|||||||
+6
@@ -42460,6 +42460,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47716.kt")
|
||||||
|
public void testKt47716() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt47716.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
||||||
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
||||||
|
|||||||
+5
@@ -34180,6 +34180,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47716.kt")
|
||||||
|
public void testKt47716() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt47716.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
||||||
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -28460,6 +28460,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47716.kt")
|
||||||
|
public void testKt47716() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt47716.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
||||||
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt");
|
||||||
|
|||||||
Generated
+5
@@ -27866,6 +27866,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47716.kt")
|
||||||
|
public void testKt47716() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt47716.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
||||||
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt");
|
||||||
|
|||||||
Generated
+5
@@ -27826,6 +27826,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47716.kt")
|
||||||
|
public void testKt47716() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt47716.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
||||||
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -15849,6 +15849,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286a.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47716.kt")
|
||||||
|
public void testKt47716() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/unsignedTypes/kt47716.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
@TestMetadata("literalEqualsNullableUnsigned.kt")
|
||||||
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
public void testLiteralEqualsNullableUnsigned() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt");
|
runTest("compiler/testData/codegen/box/unsignedTypes/literalEqualsNullableUnsigned.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user