JVM_IR KT-50076 don't null check moved dispatch receiver parameter
This commit is contained in:
+6
@@ -3962,6 +3962,12 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/interfaces/noAnyMethodsOnInterfaceInheritance.kt");
|
runTest("compiler/testData/codegen/bytecodeText/interfaces/noAnyMethodsOnInterfaceInheritance.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("noNullCheckOnThisInDefaultMethod.kt")
|
||||||
|
public void testNoNullCheckOnThisInDefaultMethod() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/interfaces/noNullCheckOnThisInDefaultMethod.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("noPrivateMemberInJavaInterface.kt")
|
@TestMetadata("noPrivateMemberInJavaInterface.kt")
|
||||||
public void testNoPrivateMemberInJavaInterface() throws Exception {
|
public void testNoPrivateMemberInJavaInterface() throws Exception {
|
||||||
|
|||||||
+4
-1
@@ -321,7 +321,10 @@ class ExpressionCodegen(
|
|||||||
irFunction.origin == IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA
|
irFunction.origin == IrDeclarationOrigin.LOCAL_FUNCTION_FOR_LAMBDA
|
||||||
|
|
||||||
private fun generateNonNullAssertion(param: IrValueParameter) {
|
private fun generateNonNullAssertion(param: IrValueParameter) {
|
||||||
if (param.origin == JvmLoweredDeclarationOrigin.FIELD_FOR_OUTER_THIS) return
|
if (param.origin == JvmLoweredDeclarationOrigin.FIELD_FOR_OUTER_THIS ||
|
||||||
|
param.origin == IrDeclarationOrigin.MOVED_DISPATCH_RECEIVER
|
||||||
|
)
|
||||||
|
return
|
||||||
val asmType = param.type.asmType
|
val asmType = param.type.asmType
|
||||||
if (!param.type.unboxInlineClass().isNullable() && !isPrimitive(asmType)) {
|
if (!param.type.unboxInlineClass().isNullable() && !isPrimitive(asmType)) {
|
||||||
mv.load(findLocalIndex(param.symbol), asmType)
|
mv.load(findLocalIndex(param.symbol), asmType)
|
||||||
|
|||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
interface Test {
|
||||||
|
fun foo() = "abc"
|
||||||
|
fun String.bar() = "def"
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1 check
|
||||||
|
// ^ no null check for dispatch receiver parameters in 'foo' and 'bar',
|
||||||
|
// extension receiver parameter in 'bar' is checked
|
||||||
+6
@@ -3818,6 +3818,12 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/interfaces/noAnyMethodsOnInterfaceInheritance.kt");
|
runTest("compiler/testData/codegen/bytecodeText/interfaces/noAnyMethodsOnInterfaceInheritance.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("noNullCheckOnThisInDefaultMethod.kt")
|
||||||
|
public void testNoNullCheckOnThisInDefaultMethod() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/interfaces/noNullCheckOnThisInDefaultMethod.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("noPrivateMemberInJavaInterface.kt")
|
@TestMetadata("noPrivateMemberInJavaInterface.kt")
|
||||||
public void testNoPrivateMemberInJavaInterface() throws Exception {
|
public void testNoPrivateMemberInJavaInterface() throws Exception {
|
||||||
|
|||||||
+6
@@ -3962,6 +3962,12 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/interfaces/noAnyMethodsOnInterfaceInheritance.kt");
|
runTest("compiler/testData/codegen/bytecodeText/interfaces/noAnyMethodsOnInterfaceInheritance.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("noNullCheckOnThisInDefaultMethod.kt")
|
||||||
|
public void testNoNullCheckOnThisInDefaultMethod() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/interfaces/noNullCheckOnThisInDefaultMethod.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("noPrivateMemberInJavaInterface.kt")
|
@TestMetadata("noPrivateMemberInJavaInterface.kt")
|
||||||
public void testNoPrivateMemberInJavaInterface() throws Exception {
|
public void testNoPrivateMemberInJavaInterface() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user