JVM_IR KT-43519 no delegates for external funs in multifile facades

Also add ABI tests for @JvmStatic/JvmOverloads + 'external'.
This commit is contained in:
Dmitry Petrov
2020-12-01 12:40:03 +03:00
parent 2b4564059e
commit e96fc74ffa
9 changed files with 100 additions and 0 deletions
@@ -145,6 +145,9 @@ private fun generateMultifileFacades(
for (member in partClass.declarations) {
if (member !is IrSimpleFunction) continue
// KT-43519 Don't generate delegates for external methods
if (member.isExternal) continue
val correspondingProperty = member.correspondingPropertySymbol?.owner
if (member.hasAnnotation(INLINE_ONLY_ANNOTATION_FQ_NAME) ||
correspondingProperty?.hasAnnotation(INLINE_ONLY_ANNOTATION_FQ_NAME) == true
@@ -0,0 +1,4 @@
// WITH_RUNTIME
@JvmOverloads
external fun foo(x: Int = 42)
@@ -0,0 +1,7 @@
@kotlin.Metadata
public final class JvmOverloadsExternalKt {
// source: 'jvmOverloadsExternal.kt'
public synthetic static method foo$default(p0: int, p1: int, p2: java.lang.Object): void
public final static @kotlin.jvm.JvmOverloads method foo(): void
public native final static @kotlin.jvm.JvmOverloads method foo(p0: int): void
}
@@ -0,0 +1,14 @@
// WITH_RUNTIME
// JVM_TARGET: 1.8
object TestObject {
@JvmStatic
external fun foo()
}
class TestClassCompanion {
companion object {
@JvmStatic
external fun foo()
}
}
@@ -0,0 +1,27 @@
@kotlin.Metadata
public final class TestClassCompanion$Companion {
// source: 'jvmStaticExternal.kt'
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public final @kotlin.jvm.JvmStatic method foo(): void
public final inner class TestClassCompanion$Companion
}
@kotlin.Metadata
public final class TestClassCompanion {
// source: 'jvmStaticExternal.kt'
public final static @org.jetbrains.annotations.NotNull field Companion: TestClassCompanion$Companion
static method <clinit>(): void
public method <init>(): void
public native final static @kotlin.jvm.JvmStatic method foo(): void
public final inner class TestClassCompanion$Companion
}
@kotlin.Metadata
public final class TestObject {
// source: 'jvmStaticExternal.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: TestObject
static method <clinit>(): void
private method <init>(): void
public native final static @kotlin.jvm.JvmStatic method foo(): void
}
+5
View File
@@ -0,0 +1,5 @@
// WITH_RUNTIME
@file:JvmMultifileClass()
@file:JvmName("a")
external fun externalFun(): Long
+10
View File
@@ -0,0 +1,10 @@
@kotlin.Metadata
public final class a {
// source: 'kt43519.kt'
}
@kotlin.Metadata
synthetic final class a__Kt43519Kt {
// source: 'kt43519.kt'
public native final static method externalFun(): long
}
@@ -99,6 +99,16 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
runTest("compiler/testData/codegen/bytecodeListing/jvmOverloadsAndParametersAnnotations.kt");
}
@TestMetadata("jvmOverloadsExternal.kt")
public void testJvmOverloadsExternal() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.kt");
}
@TestMetadata("jvmStaticExternal.kt")
public void testJvmStaticExternal() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/jvmStaticExternal.kt");
}
@TestMetadata("jvmStaticWithDefaultParameters.kt")
public void testJvmStaticWithDefaultParameters() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/jvmStaticWithDefaultParameters.kt");
@@ -124,6 +134,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
runTest("compiler/testData/codegen/bytecodeListing/kt43440.kt");
}
@TestMetadata("kt43519.kt")
public void testKt43519() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/kt43519.kt");
}
@TestMetadata("localFunctionInInitBlock.kt")
public void testLocalFunctionInInitBlock() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/localFunctionInInitBlock.kt");
@@ -99,6 +99,16 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
runTest("compiler/testData/codegen/bytecodeListing/jvmOverloadsAndParametersAnnotations.kt");
}
@TestMetadata("jvmOverloadsExternal.kt")
public void testJvmOverloadsExternal() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/jvmOverloadsExternal.kt");
}
@TestMetadata("jvmStaticExternal.kt")
public void testJvmStaticExternal() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/jvmStaticExternal.kt");
}
@TestMetadata("jvmStaticWithDefaultParameters.kt")
public void testJvmStaticWithDefaultParameters() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/jvmStaticWithDefaultParameters.kt");
@@ -124,6 +134,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
runTest("compiler/testData/codegen/bytecodeListing/kt43440.kt");
}
@TestMetadata("kt43519.kt")
public void testKt43519() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/kt43519.kt");
}
@TestMetadata("localFunctionInInitBlock.kt")
public void testLocalFunctionInInitBlock() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/localFunctionInInitBlock.kt");