Add test for KT-55931
This commit is contained in:
committed by
Space Team
parent
d18672bfb1
commit
a37e3def14
+16
@@ -14904,6 +14904,22 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/inference/callableReferences")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class CallableReferences {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInCallableReferences() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/callableReferences"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt55931.kt")
|
||||||
|
public void testKt55931() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/callableReferences/kt55931.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes")
|
@TestMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+16
@@ -14910,6 +14910,22 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/inference/callableReferences")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class CallableReferences {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInCallableReferences() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/callableReferences"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt55931.kt")
|
||||||
|
public void testKt55931() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/callableReferences/kt55931.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes")
|
@TestMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+16
@@ -14904,6 +14904,22 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/inference/callableReferences")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class CallableReferences {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInCallableReferences() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/callableReferences"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt55931.kt")
|
||||||
|
public void testKt55931() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/callableReferences/kt55931.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes")
|
@TestMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
// ISSUE: KT-55931
|
||||||
|
// SKIP_TXT
|
||||||
|
|
||||||
|
fun fun1() {}
|
||||||
|
fun fun2() {}
|
||||||
|
|
||||||
|
fun takeLambda(lambda: () -> Unit) = lambda()
|
||||||
|
|
||||||
|
fun foo(b: Boolean) {
|
||||||
|
val x1 = if (b) { ::fun1 } else { ::fun2 } // OK
|
||||||
|
takeLambda {
|
||||||
|
val x2 = if (b) ::fun1 else ::fun2 // OK
|
||||||
|
// NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER and DEBUG_UNRESOLVED on both callable references
|
||||||
|
// Since 1.4.0 (NI)
|
||||||
|
val x3 = if (b) { ::fun1 } else { ::fun2 }
|
||||||
|
}
|
||||||
|
|
||||||
|
val w: () -> Unit = {
|
||||||
|
val x4 = if (b) ::fun1 else ::fun2 // OK
|
||||||
|
// OK, too
|
||||||
|
val x5 = if (b) { ::fun1 } else { ::fun2 }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// ISSUE: KT-55931
|
||||||
|
// SKIP_TXT
|
||||||
|
|
||||||
|
fun fun1() {}
|
||||||
|
fun fun2() {}
|
||||||
|
|
||||||
|
fun takeLambda(lambda: () -> Unit) = lambda()
|
||||||
|
|
||||||
|
fun foo(b: Boolean) {
|
||||||
|
val x1 = if (b) { ::fun1 } else { ::fun2 } // OK
|
||||||
|
takeLambda {
|
||||||
|
val x2 = if (b) ::fun1 else ::fun2 // OK
|
||||||
|
// NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER and DEBUG_UNRESOLVED on both callable references
|
||||||
|
// Since 1.4.0 (NI)
|
||||||
|
val x3 = if (b) { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>fun1<!><!> } else { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>fun2<!><!> }
|
||||||
|
}
|
||||||
|
|
||||||
|
val w: () -> Unit = {
|
||||||
|
val x4 = if (b) ::fun1 else ::fun2 // OK
|
||||||
|
// OK, too
|
||||||
|
val x5 = if (b) { ::fun1 } else { ::fun2 }
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+16
@@ -14910,6 +14910,22 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/inference/callableReferences")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class CallableReferences {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInCallableReferences() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/callableReferences"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt55931.kt")
|
||||||
|
public void testKt55931() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/callableReferences/kt55931.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes")
|
@TestMetadata("compiler/testData/diagnostics/tests/inference/capturedTypes")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
Reference in New Issue
Block a user