Generate method calls for inline classes through IC, not IC$Erased
IC extends IC$Erased, so it should be fine.
This commit is contained in:
@@ -910,7 +910,7 @@ public class KotlinTypeMapper {
|
||||
ClassDescriptor receiver = (currentIsInterface && !originalIsInterface) || currentOwner instanceof FunctionClassDescriptor
|
||||
? declarationOwner
|
||||
: currentOwner;
|
||||
owner = toInlinedErasedClass ? mapErasedInlineClass(receiver) : mapClass(receiver);
|
||||
owner = mapClass(receiver);
|
||||
thisClass = owner;
|
||||
dispatchReceiverKotlinType = receiver.getDefaultType();
|
||||
}
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ inline class Foo(val x: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
// 1 INVOKESTATIC Foo\$Erased.empty \(I\)V
|
||||
// 1 INVOKESTATIC Foo\$Erased.withParam \(ILjava/lang/String;\)V
|
||||
// 1 INVOKESTATIC Foo\$Erased.withInlineClassParam-1e4ch6lh \(II\)V
|
||||
// 1 INVOKESTATIC Foo\.empty \(I\)V
|
||||
// 1 INVOKESTATIC Foo\.withParam \(ILjava/lang/String;\)V
|
||||
// 1 INVOKESTATIC Foo\.withInlineClassParam-1e4ch6lh \(II\)V
|
||||
// 5 INVOKEVIRTUAL
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
// FILE: Z.kt
|
||||
inline class Z(val x: Int)
|
||||
|
||||
// FILE: test.kt
|
||||
fun testZ(z: Z) = z.equals(z)
|
||||
fun testZ(z: Z, a: Any?) = z.equals(a)
|
||||
fun testNZ(z: Z?) = z?.equals(z)
|
||||
|
||||
// @TestKt.class:
|
||||
// 0 INVOKESTATIC Z\$Erased\.equals
|
||||
// 0 INVOKESTATIC Z\-Erased\.equals
|
||||
// 3 INVOKESTATIC Z\.equals \(ILjava/lang/Object;\)Z
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
// FILE: Z.kt
|
||||
inline class Z(val x: Int)
|
||||
|
||||
// FILE: Test.kt
|
||||
fun testZ(z: Z) = z.hashCode()
|
||||
fun testNZ(z: Z?) = z?.hashCode()
|
||||
|
||||
// @TestKt.class:
|
||||
// 0 INVOKESTATIC Z\$Erased\.hashCode
|
||||
// 0 INVOKESTATIC Z\-Erased\.hashCode
|
||||
// 2 INVOKESTATIC Z\.hashCode \(I\)I
|
||||
+2
-2
@@ -24,7 +24,7 @@ fun test(a: Any, b: Any?) {
|
||||
// 2 INSTANCEOF UInt
|
||||
// 2 CHECKCAST UInt
|
||||
|
||||
// 1 INVOKEVIRTUAL UInt.unbox
|
||||
// 1 INVOKESTATIC UInt\$Erased.member
|
||||
// 1 INVOKEVIRTUAL UInt\.unbox
|
||||
// 1 INVOKESTATIC UInt\.member
|
||||
|
||||
// 0 intValue
|
||||
Vendored
+2
-2
@@ -14,5 +14,5 @@ fun test(f: Foo) {
|
||||
f.notInlineInc() // one here
|
||||
}
|
||||
|
||||
// 0 INVOKESTATIC Foo\$Erased.inlineInc
|
||||
// 1 INVOKESTATIC Foo\$Erased.notInlineInc
|
||||
// 0 INVOKESTATIC Foo\.inlineInc
|
||||
// 1 INVOKESTATIC Foo\.notInlineInc
|
||||
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class Z(val x: Int) {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
fun testZ(z: Z) = z.foo()
|
||||
fun testNZ(z: Z?) = z?.foo()
|
||||
|
||||
// 0 INVOKESTATIC Z\$Erased\.foo
|
||||
// 0 INVOKESTATIC Z\-Erased\.foo
|
||||
// 2 INVOKESTATIC Z\.foo \(I\)V
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
// FILE: Z.kt
|
||||
interface IFoo {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
inline class Z(val x: Int) : IFoo {
|
||||
override fun foo() {}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
fun testZ(z: Z) = z.foo()
|
||||
|
||||
fun testNZ(z: Z?) = z?.foo()
|
||||
|
||||
// @TestKt.class:
|
||||
// 0 INVOKESTATIC Z\$Erased\.foo
|
||||
// 0 INVOKESTATIC Z\-Erased\.foo
|
||||
// 2 INVOKESTATIC Z\.foo \(I\)V
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
// FILE: Z.kt
|
||||
inline class Z(val x: Int)
|
||||
|
||||
// FILE: test.kt
|
||||
fun testZ(z: Z) = z.toString()
|
||||
fun testNZ(z: Z?) = z?.toString()
|
||||
|
||||
// @TestKt.class:
|
||||
// 0 INVOKESTATIC Z\$Erased\.toString
|
||||
// 0 INVOKESTATIC Z\-Erased\.toString
|
||||
// 2 INVOKESTATIC Z\.toString \(I\)Ljava/lang/String;
|
||||
@@ -2073,6 +2073,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/generationOfAccessorToUnderlyingValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("hashCodeIsCalledByInlineClass.kt")
|
||||
public void testHashCodeIsCalledByInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/hashCodeIsCalledByInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassBoxingOnAssignment.kt")
|
||||
public void testInlineClassBoxingOnAssignment() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/inlineClassBoxingOnAssignment.kt");
|
||||
@@ -2123,6 +2128,16 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/noBoxingOperationsOnNonTrivialSpread.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonOverridingMethodsAreCalledByInlineClass.kt")
|
||||
public void testNonOverridingMethodsAreCalledByInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/nonOverridingMethodsAreCalledByInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overridingMethodsAreCalledByInlineClass.kt")
|
||||
public void testOverridingMethodsAreCalledByInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/overridingMethodsAreCalledByInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("passInlineClassesWithSpreadOperatorToVarargs.kt")
|
||||
public void testPassInlineClassesWithSpreadOperatorToVarargs() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/passInlineClassesWithSpreadOperatorToVarargs.kt");
|
||||
@@ -2143,6 +2158,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/synthesizedBoxMethodIsNotMangled.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("toStringIsCalledByInlineClass.kt")
|
||||
public void testToStringIsCalledByInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/toStringIsCalledByInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("uIntArrayIteratorWithoutBoxing.kt")
|
||||
public void testUIntArrayIteratorWithoutBoxing() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/inlineClasses/uIntArrayIteratorWithoutBoxing.kt");
|
||||
|
||||
Reference in New Issue
Block a user