K2: add test for KT-59241
This commit is contained in:
committed by
Space Team
parent
a71437335b
commit
ab1d634ad3
+6
@@ -24752,6 +24752,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
|||||||
public void testSubstitutionInSuperType() throws Exception {
|
public void testSubstitutionInSuperType() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/substitutionInSuperType.kt");
|
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/substitutionInSuperType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("supplier.kt")
|
||||||
|
public void testSupplier() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/supplier.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+6
@@ -24752,6 +24752,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
|||||||
public void testSubstitutionInSuperType() throws Exception {
|
public void testSubstitutionInSuperType() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/substitutionInSuperType.kt");
|
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/substitutionInSuperType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("supplier.kt")
|
||||||
|
public void testSupplier() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/supplier.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+6
@@ -24752,6 +24752,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
|||||||
public void testSubstitutionInSuperType() throws Exception {
|
public void testSubstitutionInSuperType() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/substitutionInSuperType.kt");
|
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/substitutionInSuperType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("supplier.kt")
|
||||||
|
public void testSupplier() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/supplier.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+6
@@ -24758,6 +24758,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
|||||||
public void testSubstitutionInSuperType() throws Exception {
|
public void testSubstitutionInSuperType() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/substitutionInSuperType.kt");
|
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/substitutionInSuperType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("supplier.kt")
|
||||||
|
public void testSupplier() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/supplier.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
// FULL_JDK
|
||||||
|
|
||||||
|
// FILE: JavaClass.java
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class JavaClass {
|
||||||
|
public static <E> void consume(@NotNull E value) {}
|
||||||
|
public static <E> void compute(Supplier<@NotNull E> computable) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: KotlinMain.kt
|
||||||
|
fun test1() {
|
||||||
|
JavaClass.compute { <!ARGUMENT_TYPE_MISMATCH!>42.apply {}<!> }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test2() {
|
||||||
|
JavaClass.compute { <!ARGUMENT_TYPE_MISMATCH!>if (true) 42 else 42<!> }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test3() {
|
||||||
|
42.<!INAPPLICABLE_CANDIDATE!>apply<!>(JavaClass::<!UNRESOLVED_REFERENCE!>consume<!>)
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
// FULL_JDK
|
||||||
|
|
||||||
|
// FILE: JavaClass.java
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class JavaClass {
|
||||||
|
public static <E> void consume(@NotNull E value) {}
|
||||||
|
public static <E> void compute(Supplier<@NotNull E> computable) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: KotlinMain.kt
|
||||||
|
fun test1() {
|
||||||
|
JavaClass.compute { 42.apply {} }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test2() {
|
||||||
|
JavaClass.compute { if (true) 42 else 42 }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test3() {
|
||||||
|
42.apply(JavaClass::consume)
|
||||||
|
}
|
||||||
Generated
+6
@@ -25572,6 +25572,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
public void testSubstitutionInSuperType() throws Exception {
|
public void testSubstitutionInSuperType() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/substitutionInSuperType.kt");
|
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/substitutionInSuperType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("supplier.kt")
|
||||||
|
public void testSupplier() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/supplier.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
Reference in New Issue
Block a user