Generate deprecated flag on getter of const val's

This commit is contained in:
Denis Zharkov
2015-09-25 16:13:31 +03:00
parent 1c6ca9d036
commit 505cb37052
3 changed files with 28 additions and 0 deletions
@@ -288,6 +288,9 @@ public class AsmUtil {
public static int getDeprecatedAccessFlag(@NotNull MemberDescriptor descriptor) {
if (descriptor instanceof PropertyAccessorDescriptor) {
if (((PropertyAccessorDescriptor) descriptor).getCorrespondingProperty().isConst()) {
return ACC_DEPRECATED;
}
return KotlinBuiltIns.isDeprecated(descriptor)
? ACC_DEPRECATED
: getDeprecatedAccessFlag(((PropertyAccessorDescriptor) descriptor).getCorrespondingProperty());
@@ -0,0 +1,19 @@
const val CONST_VAL = 1
object A {
const val CONST_VAL = 2
}
class B {
companion object {
const val CONST_VAL = 2
}
}
/*
One DEPRECATED is for _DefaultPackage
One is for _DefaultPackage.getCONST_VAL
3 others are for getCONST_VAL
*/
// 5 DEPRECATED
@@ -95,6 +95,12 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
doTest(fileName);
}
@TestMetadata("constValsGetterDeprecated.kt")
public void testConstValsGetterDeprecated() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/constValsGetterDeprecated.kt");
doTest(fileName);
}
@TestMetadata("defaultDelegation.kt")
public void testDefaultDelegation() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/defaultDelegation.kt");