JVM_IR KT-40305 no nullability assertions on built-in stubs

This commit is contained in:
Dmitry Petrov
2020-11-30 12:48:13 +03:00
parent b2aed536c9
commit 96ed99d62e
6 changed files with 56 additions and 0 deletions
@@ -5058,6 +5058,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/collections/javaCollectionWithRemovePrimitiveInt.kt");
}
@TestMetadata("kt40305.kt")
public void testKt40305() throws Exception {
runTest("compiler/testData/codegen/box/collections/kt40305.kt");
}
@TestMetadata("kt41123.kt")
public void testKt41123() throws Exception {
runTest("compiler/testData/codegen/box/collections/kt41123.kt");
@@ -295,6 +295,7 @@ class ExpressionCodegen(
irFunction.origin == IrDeclarationOrigin.BRIDGE_SPECIAL ||
irFunction.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE ||
irFunction.origin == JvmLoweredDeclarationOrigin.JVM_STATIC_WRAPPER ||
irFunction.origin == IrDeclarationOrigin.IR_BUILTINS_STUB ||
irFunction.parentAsClass.origin == JvmLoweredDeclarationOrigin.CONTINUATION_CLASS ||
irFunction.parentAsClass.origin == JvmLoweredDeclarationOrigin.SUSPEND_LAMBDA ||
irFunction.isMultifileBridge()
+35
View File
@@ -0,0 +1,35 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: kt40305.kt
class ListImpl<A>(private val list: List<A>): List<A> {
override val size: Int get() = list.size
override fun contains(element: A): Boolean = list.contains(element)
override fun containsAll(elements: Collection<A>): Boolean = list.containsAll(elements)
override fun get(index: Int): A = list.get(index)
override fun indexOf(element: A): Int = list.indexOf(element)
override fun isEmpty(): Boolean = list.isEmpty()
override fun iterator(): Iterator<A> = list.iterator()
override fun lastIndexOf(element: A): Int = list.lastIndexOf(element)
override fun listIterator(): ListIterator<A> = list.listIterator()
override fun listIterator(index: Int): ListIterator<A> = list.listIterator(index)
override fun subList(fromIndex: Int, toIndex: Int): List<A> = list.subList(fromIndex, toIndex)
}
fun box(): String {
try {
J.testAddAllNull(ListImpl(listOf<String>()))
} catch (e: UnsupportedOperationException) {
return "OK"
}
return "J.testAddAllNull(ListImpl(...)) should throw UnsupportedOperationException"
}
// FILE: J.java
import java.util.List;
public class J {
public static <T> void testAddAllNull(List<T> list) {
list.addAll(null);
}
}
@@ -5088,6 +5088,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/collections/javaCollectionWithRemovePrimitiveInt.kt");
}
@TestMetadata("kt40305.kt")
public void testKt40305() throws Exception {
runTest("compiler/testData/codegen/box/collections/kt40305.kt");
}
@TestMetadata("kt41123.kt")
public void testKt41123() throws Exception {
runTest("compiler/testData/codegen/box/collections/kt41123.kt");
@@ -5088,6 +5088,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/collections/javaCollectionWithRemovePrimitiveInt.kt");
}
@TestMetadata("kt40305.kt")
public void testKt40305() throws Exception {
runTest("compiler/testData/codegen/box/collections/kt40305.kt");
}
@TestMetadata("kt41123.kt")
public void testKt41123() throws Exception {
runTest("compiler/testData/codegen/box/collections/kt41123.kt");
@@ -5058,6 +5058,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/collections/javaCollectionWithRemovePrimitiveInt.kt");
}
@TestMetadata("kt40305.kt")
public void testKt40305() throws Exception {
runTest("compiler/testData/codegen/box/collections/kt40305.kt");
}
@TestMetadata("kt41123.kt")
public void testKt41123() throws Exception {
runTest("compiler/testData/codegen/box/collections/kt41123.kt");