[FIR2IR] Always use property type if var

For destructing calls, the component type is used for the property type
in all cases. However, this can result in runtime and/or compilation
errors when the property is a var and changed, especially when the
component is a primitive but the property type is nullable. Instead,
only use the component type when the property is also a val.

^KT-64944 Fixed
This commit is contained in:
Brian Norman
2024-01-29 15:29:54 -06:00
committed by Space Team
parent 1fe8b50c19
commit dde2156f5f
23 changed files with 220 additions and 2 deletions
@@ -26853,6 +26853,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/primitiveTypes/rangeTo.kt");
}
@Test
@TestMetadata("reassignDestructured.kt")
public void testReassignDestructured() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/reassignDestructured.kt");
}
@Test
@TestMetadata("stringEqualsHashCodeToString.kt")
public void testStringEqualsHashCodeToString() throws Exception {
@@ -26853,6 +26853,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
runTest("compiler/testData/codegen/box/primitiveTypes/rangeTo.kt");
}
@Test
@TestMetadata("reassignDestructured.kt")
public void testReassignDestructured() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/reassignDestructured.kt");
}
@Test
@TestMetadata("stringEqualsHashCodeToString.kt")
public void testStringEqualsHashCodeToString() throws Exception {
@@ -26289,6 +26289,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/primitiveTypes/rangeTo.kt");
}
@Test
@TestMetadata("reassignDestructured.kt")
public void testReassignDestructured() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/reassignDestructured.kt");
}
@Test
@TestMetadata("stringEqualsHashCodeToString.kt")
public void testStringEqualsHashCodeToString() throws Exception {
@@ -26289,6 +26289,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/primitiveTypes/rangeTo.kt");
}
@Test
@TestMetadata("reassignDestructured.kt")
public void testReassignDestructured() throws Exception {
runTest("compiler/testData/codegen/box/primitiveTypes/reassignDestructured.kt");
}
@Test
@TestMetadata("stringEqualsHashCodeToString.kt")
public void testStringEqualsHashCodeToString() throws Exception {