Add blackbox test for definitely-not-null types
^KT-26245 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
30eb9ad32f
commit
bd05ef19de
+6
@@ -25296,6 +25296,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/callAssertions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNotNullTypes.kt")
|
||||
public void testDefinitelyNotNullTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/definitelyNotNullTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegation.kt")
|
||||
public void testDelegation() throws Exception {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
// FILE: JClass.java
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public abstract class JClass<T> {
|
||||
public void foo(@NotNull T x) {}
|
||||
|
||||
public static void test(JClass<String> w) {
|
||||
w.foo(null);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
class KDerived<E> : JClass<E>() {
|
||||
override fun foo(e: E!!) {
|
||||
throw RuntimeException("Should not be called")
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
JClass.test(KDerived())
|
||||
} catch (e: java.lang.NullPointerException) {
|
||||
return "OK"
|
||||
}
|
||||
return "fail"
|
||||
}
|
||||
+6
@@ -25278,6 +25278,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/callAssertions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNotNullTypes.kt")
|
||||
public void testDefinitelyNotNullTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/definitelyNotNullTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegation.kt")
|
||||
public void testDelegation() throws Exception {
|
||||
|
||||
+6
@@ -25296,6 +25296,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/callAssertions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("definitelyNotNullTypes.kt")
|
||||
public void testDefinitelyNotNullTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/definitelyNotNullTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegation.kt")
|
||||
public void testDelegation() throws Exception {
|
||||
|
||||
+5
@@ -21415,6 +21415,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/callAssertions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definitelyNotNullTypes.kt")
|
||||
public void testDefinitelyNotNullTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/definitelyNotNullTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("delegation.kt")
|
||||
public void testDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/delegation.kt");
|
||||
|
||||
Reference in New Issue
Block a user