[FE] Add regression test for KT-57036

This commit is contained in:
Dmitriy Novozhilov
2023-03-21 12:03:46 +02:00
committed by Space Team
parent e56e058b7b
commit 1ac7d13c96
7 changed files with 84 additions and 0 deletions
@@ -31442,6 +31442,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/subtyping/javaAndKotlinSuperType.kt");
}
@Test
@TestMetadata("kFunctionalCST.kt")
public void testKFunctionalCST() throws Exception {
runTest("compiler/testData/diagnostics/tests/subtyping/kFunctionalCST.kt");
}
@Test
@TestMetadata("kt2069.kt")
public void testKt2069() throws Exception {
@@ -31442,6 +31442,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/subtyping/javaAndKotlinSuperType.kt");
}
@Test
@TestMetadata("kFunctionalCST.kt")
public void testKFunctionalCST() throws Exception {
runTest("compiler/testData/diagnostics/tests/subtyping/kFunctionalCST.kt");
}
@Test
@TestMetadata("kt2069.kt")
public void testKt2069() throws Exception {
@@ -31442,6 +31442,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/subtyping/javaAndKotlinSuperType.kt");
}
@Test
@TestMetadata("kFunctionalCST.kt")
public void testKFunctionalCST() throws Exception {
runTest("compiler/testData/diagnostics/tests/subtyping/kFunctionalCST.kt");
}
@Test
@TestMetadata("kt2069.kt")
public void testKt2069() throws Exception {
@@ -31538,6 +31538,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/subtyping/javaAndKotlinSuperType.kt");
}
@Test
@TestMetadata("kFunctionalCST.kt")
public void testKFunctionalCST() throws Exception {
runTest("compiler/testData/diagnostics/tests/subtyping/kFunctionalCST.kt");
}
@Test
@TestMetadata("kt2069.kt")
public void testKt2069() throws Exception {
@@ -0,0 +1,27 @@
// INFERENCE_HELPERS
// ISSUE: KT-57036
abstract class Base(block: String.() -> Int)
class A(block: String.() -> Int) : Base(block)
class B(block: String.() -> Int) : Base(block)
fun test_1() {
val c = select(::A, ::B)
c { length }
c { <!UNRESOLVED_REFERENCE!>it<!>.length }
}
fun test_2(cond: Boolean) {
val c = if (cond) ::A else ::B
c { length }
c { <!UNRESOLVED_REFERENCE!>it<!>.length }
}
fun test_3(cond: Boolean) {
val c = when(cond) {
true -> ::A
false -> ::B
}
c { length }
c { <!UNRESOLVED_REFERENCE!>it<!>.length }
}
@@ -0,0 +1,27 @@
// INFERENCE_HELPERS
// ISSUE: KT-57036
abstract class Base(block: String.() -> Int)
class A(block: String.() -> Int) : Base(block)
class B(block: String.() -> Int) : Base(block)
fun test_1() {
val c = select(::A, ::B)
c <!TYPE_MISMATCH!>{ <!UNRESOLVED_REFERENCE!>length<!> }<!>
c { it.length }
}
fun test_2(cond: Boolean) {
val c = if (cond) ::A else ::B
c <!TYPE_MISMATCH!>{ <!UNRESOLVED_REFERENCE!>length<!> }<!>
c { it.length }
}
fun test_3(cond: Boolean) {
val c = when(cond) {
true -> ::A
false -> ::B
}
c <!TYPE_MISMATCH!>{ <!UNRESOLVED_REFERENCE!>length<!> }<!>
c { it.length }
}
@@ -32280,6 +32280,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/subtyping/javaAndKotlinSuperType.kt");
}
@Test
@TestMetadata("kFunctionalCST.kt")
public void testKFunctionalCST() throws Exception {
runTest("compiler/testData/diagnostics/tests/subtyping/kFunctionalCST.kt");
}
@Test
@TestMetadata("kt2069.kt")
public void testKt2069() throws Exception {