Test visibility of anonymous classes for callable references

This commit is contained in:
Alexander Udalov
2015-07-10 16:04:13 +03:00
parent 3b2be6212d
commit f8815d9450
6 changed files with 79 additions and 1 deletions
@@ -65,7 +65,7 @@ public class PropertyReferenceCodegen(
v.defineClass(
element,
V1_6,
ACC_FINAL or ACC_SUPER or AsmUtil.getVisibilityAccessFlagForAnonymous(classDescriptor), // TODO: test inline
ACC_FINAL or ACC_SUPER or AsmUtil.getVisibilityAccessFlagForAnonymous(classDescriptor),
asmType.getInternalName(),
null,
superAsmType.getInternalName(),
@@ -0,0 +1,9 @@
class A {
fun foo() {}
val bar = A::foo
}
// TESTED_OBJECT_KIND: class
// TESTED_OBJECTS: A$bar$1
// FLAGS: ACC_FINAL, ACC_SUPER
@@ -0,0 +1,9 @@
class A {
fun foo() {}
inline fun bar() = A::foo
}
// TESTED_OBJECT_KIND: class
// TESTED_OBJECTS: A$bar$1
// FLAGS: ACC_FINAL, ACC_PUBLIC, ACC_SUPER
@@ -0,0 +1,9 @@
class A {
val foo = ""
val bar = A::foo
}
// TESTED_OBJECT_KIND: class
// TESTED_OBJECTS: A$bar$1
// FLAGS: ACC_FINAL, ACC_SUPER
@@ -0,0 +1,9 @@
class A {
val foo = ""
inline fun bar() = A::foo
}
// TESTED_OBJECT_KIND: class
// TESTED_OBJECTS: A$bar$1
// FLAGS: ACC_FINAL, ACC_PUBLIC, ACC_SUPER
@@ -35,6 +35,48 @@ public class WriteFlagsTestGenerated extends AbstractWriteFlagsTest {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/writeFlags"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/testData/writeFlags/callableReference")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class CallableReference extends AbstractWriteFlagsTest {
public void testAllFilesPresentInCallableReference() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/writeFlags/callableReference"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("compiler/testData/writeFlags/callableReference/visibility")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Visibility extends AbstractWriteFlagsTest {
public void testAllFilesPresentInVisibility() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/writeFlags/callableReference/visibility"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("functionReference.kt")
public void testFunctionReference() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/writeFlags/callableReference/visibility/functionReference.kt");
doTest(fileName);
}
@TestMetadata("functionReferenceInInlineFunction.kt")
public void testFunctionReferenceInInlineFunction() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/writeFlags/callableReference/visibility/functionReferenceInInlineFunction.kt");
doTest(fileName);
}
@TestMetadata("propertyReference.kt")
public void testPropertyReference() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/writeFlags/callableReference/visibility/propertyReference.kt");
doTest(fileName);
}
@TestMetadata("propertyReferenceInInlineFunction.kt")
public void testPropertyReferenceInInlineFunction() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/writeFlags/callableReference/visibility/propertyReferenceInInlineFunction.kt");
doTest(fileName);
}
}
}
@TestMetadata("compiler/testData/writeFlags/class")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)