Properly cast right-hand side value for inline property setter

#KT-22649 Fixed
This commit is contained in:
Mikhael Bogdanov
2018-09-06 14:15:14 +02:00
parent 5cb8108eec
commit da93ff1a30
7 changed files with 46 additions and 1 deletions
@@ -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);
}
+17
View File
@@ -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
}
@@ -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");
@@ -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");
@@ -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");
@@ -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");
@@ -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");