[FIR-TEST] Add test with unresolved SAM usage of Comparator
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
|||||||
|
fun test_1() {
|
||||||
|
val comp = <!UNRESOLVED_REFERENCE!>Comparator<!><Int> { x, y -> 1 }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test_2(list: List<Int>) {
|
||||||
|
val comp = java.util.<!UNRESOLVED_REFERENCE!>Comparator<!><Int> { x, y -> 1 }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test_3(comparator: java.util.Comparator<Int>) {
|
||||||
|
comparator.compare(1, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test_4(comparator: Comparator<Int>) {
|
||||||
|
comparator.compare(1, 2)
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
FILE: unresolvedComparator.kt
|
||||||
|
public final fun test_1(): R|kotlin/Unit| {
|
||||||
|
lval comp: <ERROR TYPE REF: Unresolved name: Comparator> = <Unresolved name: Comparator>#<R|kotlin/Int|>(<L> = Comparator@fun <anonymous>(x: R|class error: No type for parameter|, y: R|class error: No type for parameter|): R|kotlin/Int| {
|
||||||
|
Int(1)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
public final fun test_2(list: R|kotlin/collections/List<kotlin/Int>|): R|kotlin/Unit| {
|
||||||
|
lval comp: <ERROR TYPE REF: Unresolved name: Comparator> = Q|java/util|.<Unresolved name: Comparator>#<R|kotlin/Int|>(<L> = Comparator@fun <anonymous>(x: R|class error: No type for parameter|, y: R|class error: No type for parameter|): R|kotlin/Int| {
|
||||||
|
Int(1)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
public final fun test_3(comparator: R|java/util/Comparator<kotlin/Int>|): R|kotlin/Unit| {
|
||||||
|
R|<local>/comparator|.R|FakeOverride<java/util/Comparator.compare: R|kotlin/Int|>|(Int(1), Int(2))
|
||||||
|
}
|
||||||
|
public final fun test_4(comparator: R|kotlin/Comparator<kotlin/Int>|): R|kotlin/Unit| {
|
||||||
|
R|<local>/comparator|.R|FakeOverride<java/util/Comparator.compare: R|kotlin/Int|>|(Int(1), Int(2))
|
||||||
|
}
|
||||||
Generated
+18
@@ -481,4 +481,22 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
|
|||||||
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/StaticGenericMethod.kt");
|
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/StaticGenericMethod.kt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/fir/resolve/testData/resolve/stdlib/problems")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class Problems extends AbstractFirDiagnosticsWithStdlibTest {
|
||||||
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
|
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAllFilesPresentInProblems() throws Exception {
|
||||||
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/fir/resolve/testData/resolve/stdlib/problems"), Pattern.compile("^([^.]+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("unresolvedComparator.kt")
|
||||||
|
public void testUnresolvedComparator() throws Exception {
|
||||||
|
runTest("compiler/fir/resolve/testData/resolve/stdlib/problems/unresolvedComparator.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user