Update test affected by ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated feature
This commit is contained in:
+6
@@ -26790,6 +26790,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/doGenerateParamAssertions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inFunctionWithExpressionBodyWithJavaGeneric.kt")
|
||||
public void testInFunctionWithExpressionBodyWithJavaGeneric() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/inFunctionWithExpressionBodyWithJavaGeneric.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("messageLength.kt")
|
||||
public void testMessageLength() throws Exception {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions -ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
|
||||
// TARGET_BACKEND: JVM
|
||||
// See KT-8135
|
||||
// We could generate runtime assertion on call site for 'generic<NOT_NULL_TYPE>()' below.
|
||||
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// !LANGUAGE: +StrictJavaNullabilityAssertions +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_LIGHT_ANALYSIS
|
||||
|
||||
// FILE: box.kt
|
||||
fun box(): String {
|
||||
try {
|
||||
J().test()
|
||||
return "Fail: SHOULD throw exception"
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
fun withAssertion(j: J) = generic<String?>(j)
|
||||
|
||||
fun <T> generic(j: J) = j.nullT<T>()
|
||||
|
||||
// FILE: J.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public <T> T nullT() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void test() {
|
||||
TestKt.withAssertion(this);
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -9,6 +9,6 @@ public interface TypeParamOfClass {
|
||||
|
||||
public interface Super</*0*/ T : kotlin.Any!> {
|
||||
public abstract fun dummy(): kotlin.Unit
|
||||
@org.jetbrains.annotations.NotNull public abstract fun foo(): T
|
||||
@org.jetbrains.annotations.NotNull public abstract fun foo(): T!!
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,6 +9,6 @@ public interface TypeParamOfClassSubstituted {
|
||||
|
||||
public interface Super</*0*/ T : kotlin.Any!> {
|
||||
public abstract fun dummy(): kotlin.Unit
|
||||
@org.jetbrains.annotations.NotNull public abstract fun foo(): T
|
||||
@org.jetbrains.annotations.NotNull public abstract fun foo(): T!!
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -9,6 +9,6 @@ public interface TypeParamOfFun {
|
||||
|
||||
public interface Super {
|
||||
public abstract fun dummy(): kotlin.Unit
|
||||
@org.jetbrains.annotations.NotNull public abstract fun </*0*/ T : kotlin.Any!> foo(): T
|
||||
@org.jetbrains.annotations.NotNull public abstract fun </*0*/ T : kotlin.Any!> foo(): T!!
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -26688,6 +26688,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/doGenerateParamAssertions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inFunctionWithExpressionBodyWithJavaGeneric.kt")
|
||||
public void testInFunctionWithExpressionBodyWithJavaGeneric() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/inFunctionWithExpressionBodyWithJavaGeneric.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("messageLength.kt")
|
||||
public void testMessageLength() throws Exception {
|
||||
|
||||
+6
@@ -26790,6 +26790,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/doGenerateParamAssertions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inFunctionWithExpressionBodyWithJavaGeneric.kt")
|
||||
public void testInFunctionWithExpressionBodyWithJavaGeneric() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/inFunctionWithExpressionBodyWithJavaGeneric.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("messageLength.kt")
|
||||
public void testMessageLength() throws Exception {
|
||||
|
||||
+5
@@ -22593,6 +22593,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class NotNullAssertions extends AbstractLightAnalysisModeTest {
|
||||
@TestMetadata("inFunctionWithExpressionBodyWithJavaGeneric.kt")
|
||||
public void ignoreInFunctionWithExpressionBodyWithJavaGeneric() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/notNullAssertions/inFunctionWithExpressionBodyWithJavaGeneric.kt");
|
||||
}
|
||||
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user