Properly cast right-hand side value for inline property setter
#KT-22649 Fixed
This commit is contained in:
@@ -1619,7 +1619,10 @@ public abstract class StackValue {
|
||||
putReceiver(v, false);
|
||||
}
|
||||
callGenerator.processAndPutHiddenParameters(true);
|
||||
callGenerator.putValueIfNeeded(new JvmKotlinType(rightSide.type, rightSide.kotlinType), rightSide);
|
||||
callGenerator.putValueIfNeeded(new JvmKotlinType(
|
||||
CollectionsKt.last(setter.getValueParameters()).getAsmType(),
|
||||
CollectionsKt.last(setterDescriptor.getValueParameters()).getType()),
|
||||
rightSide);
|
||||
callGenerator.putHiddenParamsIntoLocals();
|
||||
callGenerator.genCall(setter, resolvedCall, false, codegen);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// FILE: 1.kt
|
||||
var result = ""
|
||||
|
||||
inline var apx:Int
|
||||
get() = 0
|
||||
set(value) { result = if (value == 1) "OK" else "fail" }
|
||||
|
||||
|
||||
// FILE: 2.kt
|
||||
fun test(s: Int?) {
|
||||
apx = s!!
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
test(1)
|
||||
return result
|
||||
}
|
||||
+5
@@ -2410,6 +2410,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt22649.kt")
|
||||
public void testKt22649() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/property/kt22649.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("property.kt")
|
||||
public void testProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/property/property.kt");
|
||||
|
||||
Generated
+5
@@ -2410,6 +2410,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt22649.kt")
|
||||
public void testKt22649() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/property/kt22649.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("property.kt")
|
||||
public void testProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/property/property.kt");
|
||||
|
||||
+5
@@ -2410,6 +2410,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt22649.kt")
|
||||
public void testKt22649() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/property/kt22649.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("property.kt")
|
||||
public void testProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/property/property.kt");
|
||||
|
||||
js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrPropertyAccessorsInlineTestsGenerated.java
Generated
+5
@@ -59,6 +59,11 @@ public class IrPropertyAccessorsInlineTestsGenerated extends AbstractIrPropertyA
|
||||
runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt22649.kt")
|
||||
public void testKt22649() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/property/kt22649.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("property.kt")
|
||||
public void testProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/property/property.kt");
|
||||
|
||||
Generated
+5
@@ -59,6 +59,11 @@ public class PropertyAccessorsInlineTestsGenerated extends AbstractPropertyAcces
|
||||
runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt22649.kt")
|
||||
public void testKt22649() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/property/kt22649.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("property.kt")
|
||||
public void testProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/property/property.kt");
|
||||
|
||||
Reference in New Issue
Block a user