JVM_IR KT-48433 don't generate null check on 'this$0' parameter

This commit is contained in:
Dmitry Petrov
2021-08-26 16:35:54 +03:00
parent dd98f72fd7
commit 7df5ebf6ee
5 changed files with 27 additions and 0 deletions
@@ -1594,6 +1594,12 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/constructors/inlinePrimaryDefaults.kt");
}
@Test
@TestMetadata("innerClassConstructor.kt")
public void testInnerClassConstructor() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constructors/innerClassConstructor.kt");
}
@Test
@TestMetadata("innerPrimaryDefaults.kt")
public void testInnerPrimaryDefaults() throws Exception {
@@ -328,6 +328,7 @@ class ExpressionCodegen(
irFunction.origin == IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA
private fun generateNonNullAssertion(param: IrValueParameter) {
if (param.origin == JvmLoweredDeclarationOrigin.FIELD_FOR_OUTER_THIS) return
val asmType = param.type.asmType
if (!param.type.unboxInlineClass().isNullable() && !isPrimitive(asmType)) {
mv.load(findLocalIndex(param.symbol), asmType)
@@ -0,0 +1,8 @@
class Outer {
inner class Inner1
inner class Inner2(v: String)
}
// 1 checkNotNullParameter
// 0 checkParameterIsNotNull
// 1 INVOKESTATIC
@@ -1570,6 +1570,12 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/constructors/inlinePrimaryDefaults.kt");
}
@Test
@TestMetadata("innerClassConstructor.kt")
public void testInnerClassConstructor() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constructors/innerClassConstructor.kt");
}
@Test
@TestMetadata("innerPrimaryDefaults.kt")
public void testInnerPrimaryDefaults() throws Exception {
@@ -1594,6 +1594,12 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/constructors/inlinePrimaryDefaults.kt");
}
@Test
@TestMetadata("innerClassConstructor.kt")
public void testInnerClassConstructor() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constructors/innerClassConstructor.kt");
}
@Test
@TestMetadata("innerPrimaryDefaults.kt")
public void testInnerPrimaryDefaults() throws Exception {