[NI] Prototype for SAM-conversion.

Supported:
- conversion in resolution parts. Also sam-with-receiver is supported automatically
- separate flag for kotlin function with java SAM as parameters

TODO:
- fix overload conflict error when function type is the same byte origin types is ordered
- consider case when parameter type is T, T <:> Runnable
- support vararg of Runnable

[NI] Turn off synthetic scope with SAM adapter functions if NI enabled
This commit is contained in:
Stanislav Erokhin
2018-05-01 23:46:15 +03:00
parent 4b8e95c243
commit 8f0b073c08
48 changed files with 889 additions and 26 deletions
@@ -17166,6 +17166,64 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
}
}
@TestMetadata("compiler/testData/diagnostics/tests/samConversions")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SamConversions extends AbstractDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInSamConversions() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/samConversions"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("DisabledForKTSimple.kt")
public void testDisabledForKTSimple() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/DisabledForKTSimple.kt");
}
@TestMetadata("GenericSubstitution.kt")
public void testGenericSubstitution() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/GenericSubstitution.kt");
}
@TestMetadata("GenericSubstitutionKT.kt")
public void testGenericSubstitutionKT() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/GenericSubstitutionKT.kt");
}
@TestMetadata("OverloadPriority.kt")
public void testOverloadPriority() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/OverloadPriority.kt");
}
@TestMetadata("OverloadPriorityKT.kt")
public void testOverloadPriorityKT() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/OverloadPriorityKT.kt");
}
@TestMetadata("SAMAfterSubstitution.kt")
public void testSAMAfterSubstitution() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitution.kt");
}
@TestMetadata("SAMAfterSubstitutionKT.kt")
public void testSAMAfterSubstitutionKT() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
}
@TestMetadata("SimpleCorrect.kt")
public void testSimpleCorrect() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/SimpleCorrect.kt");
}
@TestMetadata("SimpleCorrectKT.kt")
public void testSimpleCorrectKT() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/SimpleCorrectKT.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/tests/scopes")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)