[Test] Add test for KT-58754
This commit is contained in:
committed by
Space Team
parent
5717b59f52
commit
8a1372e21c
+16
@@ -39149,6 +39149,22 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/delegateInference")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class DelegateInference {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInDelegateInference() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/delegateInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("ifWithCallableReferenceInLazy.kt")
|
||||||
|
public void testIfWithCallableReferenceInLazy() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/delegateInference/ifWithCallableReferenceInLazy.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+16
@@ -39149,6 +39149,22 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/delegateInference")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class DelegateInference {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInDelegateInference() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/delegateInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("ifWithCallableReferenceInLazy.kt")
|
||||||
|
public void testIfWithCallableReferenceInLazy() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/delegateInference/ifWithCallableReferenceInLazy.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+16
@@ -39149,6 +39149,22 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/delegateInference")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class DelegateInference {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInDelegateInference() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/delegateInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("ifWithCallableReferenceInLazy.kt")
|
||||||
|
public void testIfWithCallableReferenceInLazy() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/delegateInference/ifWithCallableReferenceInLazy.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+16
@@ -39245,6 +39245,22 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/delegateInference")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class DelegateInference {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInDelegateInference() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/delegateInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("ifWithCallableReferenceInLazy.kt")
|
||||||
|
public void testIfWithCallableReferenceInLazy() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/delegateInference/ifWithCallableReferenceInLazy.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
compiler/testData/diagnostics/testsWithStdLib/delegateInference/ifWithCallableReferenceInLazy.fir.kt
Vendored
+37
@@ -0,0 +1,37 @@
|
|||||||
|
// ISSUE: KT-58754
|
||||||
|
|
||||||
|
fun foo() {}
|
||||||
|
fun bar() {}
|
||||||
|
|
||||||
|
class Test(b: Boolean) {
|
||||||
|
private val test_1 by lazy {
|
||||||
|
val a = if (b) {
|
||||||
|
::foo
|
||||||
|
} else {
|
||||||
|
::bar
|
||||||
|
}
|
||||||
|
a
|
||||||
|
}
|
||||||
|
|
||||||
|
private val test_2 by lazy {
|
||||||
|
val a = if (b) ::foo else ::bar
|
||||||
|
a
|
||||||
|
}
|
||||||
|
|
||||||
|
private val test_3 by lazy {
|
||||||
|
val a = when {
|
||||||
|
b -> { ::foo }
|
||||||
|
else -> { ::bar }
|
||||||
|
}
|
||||||
|
a
|
||||||
|
}
|
||||||
|
|
||||||
|
private val test_4 by lazy {
|
||||||
|
val a = when {
|
||||||
|
b -> ::foo
|
||||||
|
else -> ::bar
|
||||||
|
}
|
||||||
|
a
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Vendored
+37
@@ -0,0 +1,37 @@
|
|||||||
|
// ISSUE: KT-58754
|
||||||
|
|
||||||
|
fun foo() {}
|
||||||
|
fun bar() {}
|
||||||
|
|
||||||
|
class Test(b: Boolean) {
|
||||||
|
private val test_1 by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>lazy<!> {
|
||||||
|
val a = if (b) {
|
||||||
|
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!><!>
|
||||||
|
} else {
|
||||||
|
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!><!>
|
||||||
|
}
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!>
|
||||||
|
}<!>
|
||||||
|
|
||||||
|
private val test_2 by lazy {
|
||||||
|
val a = if (b) ::foo else ::bar
|
||||||
|
a
|
||||||
|
}
|
||||||
|
|
||||||
|
private val test_3 by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>lazy<!> {
|
||||||
|
val a = when {
|
||||||
|
b -> { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!><!> }
|
||||||
|
else -> { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!><!> }
|
||||||
|
}
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!>
|
||||||
|
}<!>
|
||||||
|
|
||||||
|
private val test_4 by lazy {
|
||||||
|
val a = when {
|
||||||
|
b -> ::foo
|
||||||
|
else -> ::bar
|
||||||
|
}
|
||||||
|
a
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Generated
+16
@@ -40071,6 +40071,22 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/delegateInference")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class DelegateInference {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInDelegateInference() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/delegateInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("ifWithCallableReferenceInLazy.kt")
|
||||||
|
public void testIfWithCallableReferenceInLazy() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/delegateInference/ifWithCallableReferenceInLazy.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/deprecated")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
Reference in New Issue
Block a user