K1/K2: add test for KT-62959

This commit is contained in:
Mikhail Glukhikh
2023-11-26 23:46:31 +01:00
committed by Space Team
parent 67d32c3072
commit 3c20a7b82a
7 changed files with 56 additions and 0 deletions
@@ -165,6 +165,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/Builders.kt");
}
@Test
@TestMetadata("capturedTypesSubtyping.kt")
public void testCapturedTypesSubtyping() throws Exception {
runTest("compiler/testData/diagnostics/tests/capturedTypesSubtyping.kt");
}
@Test
@TestMetadata("Casts.kt")
public void testCasts() throws Exception {
@@ -165,6 +165,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/Builders.kt");
}
@Test
@TestMetadata("capturedTypesSubtyping.kt")
public void testCapturedTypesSubtyping() throws Exception {
runTest("compiler/testData/diagnostics/tests/capturedTypesSubtyping.kt");
}
@Test
@TestMetadata("Casts.kt")
public void testCasts() throws Exception {
@@ -165,6 +165,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/Builders.kt");
}
@Test
@TestMetadata("capturedTypesSubtyping.kt")
public void testCapturedTypesSubtyping() throws Exception {
runTest("compiler/testData/diagnostics/tests/capturedTypesSubtyping.kt");
}
@Test
@TestMetadata("Casts.kt")
public void testCasts() throws Exception {
@@ -165,6 +165,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/Builders.kt");
}
@Test
@TestMetadata("capturedTypesSubtyping.kt")
public void testCapturedTypesSubtyping() throws Exception {
runTest("compiler/testData/diagnostics/tests/capturedTypesSubtyping.kt");
}
@Test
@TestMetadata("Casts.kt")
public void testCasts() throws Exception {
@@ -0,0 +1,13 @@
// ISSUE: KT-62959
fun bar(x: Inv<out CharSequence>) {
x.foo { <!ARGUMENT_TYPE_MISMATCH("CapturedType(out kotlin.CharSequence); kotlin.CharSequence")!>it<!> }
x.bar { <!ARGUMENT_TYPE_MISMATCH("CapturedType(out kotlin.CharSequence); kotlin.CharSequence"), TYPE_MISMATCH("CapturedType(out kotlin.CharSequence); CapturedType(out kotlin.CharSequence)")!>it.e()<!> }
}
interface Inv<E> {
fun foo(x: (E) -> E) {}
fun bar(x: (Inv<E>) -> E) {}
fun e(): E = null!!
}
@@ -0,0 +1,13 @@
// ISSUE: KT-62959
fun bar(x: Inv<out CharSequence>) {
x.foo { <!TYPE_MISMATCH("Nothing; CharSequence"), TYPE_MISMATCH("Nothing; CharSequence")!>it<!> }
x.bar { <!TYPE_MISMATCH("Nothing; CharSequence"), TYPE_MISMATCH("Nothing; CharSequence")!>it.e()<!> }
}
interface Inv<E> {
fun foo(x: (E) -> E) {}
fun bar(x: (Inv<E>) -> E) {}
fun e(): E = null!!
}
@@ -165,6 +165,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/Builders.kt");
}
@Test
@TestMetadata("capturedTypesSubtyping.kt")
public void testCapturedTypesSubtyping() throws Exception {
runTest("compiler/testData/diagnostics/tests/capturedTypesSubtyping.kt");
}
@Test
@TestMetadata("Casts.kt")
public void testCasts() throws Exception {