Fix VerifyError on primitive override properties

Don't just blindly map property type in PropertyCodegen when generating getter:
we already have its full signature, so we can just as well take the type from
it. The former also isn't correct for properties which are overrides with a
primitive type. Simple mapType is safe for setter though, because the type of a
method parameter cannot change with override on JVM

The change in StackValue relates to call sites of properties which return Unit:
in that case StackValue's this.type is V, whereas the return type of its getter
is Ljet/Unit; -- so coerceTo was coercing from the wrong type in case of getter
calls

 #KT-4373 Fixed
 #KT-4383 Fixed
This commit is contained in:
Alexander Udalov
2014-01-13 21:23:38 +04:00
parent b92e121458
commit 7041a10ecf
7 changed files with 86 additions and 11 deletions
@@ -4470,11 +4470,31 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest("compiler/testData/codegen/box/properties/kt4252_2.kt");
}
@TestMetadata("kt4373.kt")
public void testKt4373() throws Exception {
doTest("compiler/testData/codegen/box/properties/kt4373.kt");
}
@TestMetadata("kt4383.kt")
public void testKt4383() throws Exception {
doTest("compiler/testData/codegen/box/properties/kt4383.kt");
}
@TestMetadata("kt613.kt")
public void testKt613() throws Exception {
doTest("compiler/testData/codegen/box/properties/kt613.kt");
}
@TestMetadata("primitiveOverrideDefaultAccessor.kt")
public void testPrimitiveOverrideDefaultAccessor() throws Exception {
doTest("compiler/testData/codegen/box/properties/primitiveOverrideDefaultAccessor.kt");
}
@TestMetadata("primitiveOverrideDelegateAccessor.kt")
public void testPrimitiveOverrideDelegateAccessor() throws Exception {
doTest("compiler/testData/codegen/box/properties/primitiveOverrideDelegateAccessor.kt");
}
@TestMetadata("privatePropertyWithoutBackingField.kt")
public void testPrivatePropertyWithoutBackingField() throws Exception {
doTest("compiler/testData/codegen/box/properties/privatePropertyWithoutBackingField.kt");