Add blackbox test for definitely-not-null types

^KT-26245 Fixed
This commit is contained in:
Denis.Zharkov
2021-04-06 18:04:29 +03:00
committed by TeamCityServer
parent 30eb9ad32f
commit bd05ef19de
5 changed files with 54 additions and 0 deletions
@@ -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"
}
@@ -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 {
@@ -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 {
@@ -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");