K2: add test to confirm behavior described in KT-62918

#KT-62918 Obsolete
Related to: KT-60086, KT-59920
This commit is contained in:
Mikhail Glukhikh
2023-10-26 10:50:42 +02:00
committed by Space Team
parent a90562c0da
commit dda7004d66
8 changed files with 108 additions and 0 deletions
@@ -12350,6 +12350,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/exposed"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@Test
@TestMetadata("ambiguousAnonymousExposed.kt")
public void testAmbiguousAnonymousExposed() throws Exception {
runTest("compiler/testData/diagnostics/tests/exposed/ambiguousAnonymousExposed.kt");
}
@Test
@TestMetadata("delegate.kt")
public void testDelegate() throws Exception {
@@ -12350,6 +12350,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/exposed"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@Test
@TestMetadata("ambiguousAnonymousExposed.kt")
public void testAmbiguousAnonymousExposed() throws Exception {
runTest("compiler/testData/diagnostics/tests/exposed/ambiguousAnonymousExposed.kt");
}
@Test
@TestMetadata("delegate.kt")
public void testDelegate() throws Exception {
@@ -12344,6 +12344,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/exposed"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@Test
@TestMetadata("ambiguousAnonymousExposed.kt")
public void testAmbiguousAnonymousExposed() throws Exception {
runTest("compiler/testData/diagnostics/tests/exposed/ambiguousAnonymousExposed.kt");
}
@Test
@TestMetadata("delegate.kt")
public void testDelegate() throws Exception {
@@ -12350,6 +12350,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/exposed"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@Test
@TestMetadata("ambiguousAnonymousExposed.kt")
public void testAmbiguousAnonymousExposed() throws Exception {
runTest("compiler/testData/diagnostics/tests/exposed/ambiguousAnonymousExposed.kt");
}
@Test
@TestMetadata("delegate.kt")
public void testDelegate() throws Exception {
@@ -0,0 +1,14 @@
// ISSUE: KT-62918
// FIR_DUMP
class My<T>(val value: T)
interface I1
interface I2
<!AMBIGUOUS_ANONYMOUS_TYPE_INFERRED!>fun foo()<!> = My(object : I1, I2 {})
fun fooFoo(): My<I1> = My(object : I1, I2 {})
<!AMBIGUOUS_ANONYMOUS_TYPE_INFERRED!>internal fun bar()<!> = My(object : I1, I2 {})
private fun baz() = My(object : I1, I2 {})
@@ -0,0 +1,50 @@
FILE: ambiguousAnonymousExposed.fir.kt
public final class My<T> : R|kotlin/Any| {
public constructor<T>(value: R|T|): R|My<T>| {
super<R|kotlin/Any|>()
}
public final val value: R|T| = R|<local>/value|
public get(): R|T|
}
public abstract interface I1 : R|kotlin/Any| {
}
public abstract interface I2 : R|kotlin/Any| {
}
public final fun foo(): R|My<out I1>| {
^foo R|/My.My|<R|<anonymous>|>(object : R|I1|, R|I2| {
private constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
}
)
}
public final fun fooFoo(): R|My<I1>| {
^fooFoo R|/My.My|<R|I1|>(object : R|I1|, R|I2| {
private constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
}
)
}
internal final fun bar(): R|My<out I1>| {
^bar R|/My.My|<R|<anonymous>|>(object : R|I1|, R|I2| {
private constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
}
)
}
private final fun baz(): R|My<<anonymous>>| {
^baz R|/My.My|<R|<anonymous>|>(object : R|I1|, R|I2| {
private constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
}
)
}
@@ -0,0 +1,14 @@
// ISSUE: KT-62918
// FIR_DUMP
class My<T>(val value: T)
interface I1
interface I2
fun <!EXPOSED_FUNCTION_RETURN_TYPE!>foo<!>() = My(object : I1, I2 {})
fun fooFoo(): My<I1> = My(object : I1, I2 {})
internal fun <!EXPOSED_FUNCTION_RETURN_TYPE!>bar<!>() = My(object : I1, I2 {})
private fun baz() = My(object : I1, I2 {})
@@ -12350,6 +12350,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/exposed"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("ambiguousAnonymousExposed.kt")
public void testAmbiguousAnonymousExposed() throws Exception {
runTest("compiler/testData/diagnostics/tests/exposed/ambiguousAnonymousExposed.kt");
}
@Test
@TestMetadata("delegate.kt")
public void testDelegate() throws Exception {