Fix implicit type arguments resolution for inner classes

When resolving arguments on inner classifier, one can omit the arguments
for outer class 'Outer' if they are present implicitly in the scope:
- One of the supertypes of current class is Outer
- One of the outer classes or one of their supertypes is Outer

Relevant arguments are obtained from the first type found by
the algorithm above

Note that before this commit implicit arguments were only been searched
in containing classes

 #KT-11123 Fixed
This commit is contained in:
Denis Zharkov
2016-09-13 16:04:17 +03:00
parent 15c0901a72
commit 7ca84649d7
25 changed files with 686 additions and 57 deletions
@@ -7981,6 +7981,63 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/innerClasses/substitutedMemberScope.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ImplicitArguments extends AbstractDiagnosticsTest {
public void testAllFilesPresentInImplicitArguments() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("fromCompanionObject.kt")
public void testFromCompanionObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromCompanionObject.kt");
doTest(fileName);
}
@TestMetadata("fromOuterClassInObjectLiteral.kt")
public void testFromOuterClassInObjectLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromOuterClassInObjectLiteral.kt");
doTest(fileName);
}
@TestMetadata("fromSuperClasses.kt")
public void testFromSuperClasses() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.kt");
doTest(fileName);
}
@TestMetadata("fromSuperClassesLocal.kt")
public void testFromSuperClassesLocal() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.kt");
doTest(fileName);
}
@TestMetadata("fromSuperClassesLocalInsideInner.kt")
public void testFromSuperClassesLocalInsideInner() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.kt");
doTest(fileName);
}
@TestMetadata("fromSuperClassesTransitive.kt")
public void testFromSuperClassesTransitive() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.kt");
doTest(fileName);
}
@TestMetadata("inStaticScope.kt")
public void testInStaticScope() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/inStaticScope.kt");
doTest(fileName);
}
@TestMetadata("secondLevelDepth.kt")
public void testSecondLevelDepth() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/secondLevelDepth.kt");
doTest(fileName);
}
}
}
@TestMetadata("compiler/testData/diagnostics/tests/generics/multipleBoundsMemberScope")