Use compatibility accessors only in compatibility stubs
This commit is contained in:
+6
@@ -22092,6 +22092,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt");
|
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("superCall.kt")
|
||||||
|
public void testSuperCall() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/superCall.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("suspendFunction.kt")
|
@TestMetadata("suspendFunction.kt")
|
||||||
public void testSuspendFunction() throws Exception {
|
public void testSuspendFunction() throws Exception {
|
||||||
|
|||||||
+3
-1
@@ -575,7 +575,9 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
|
|||||||
|
|
||||||
// The only function accessors placed on interfaces are for private functions and JvmDefault implementations.
|
// The only function accessors placed on interfaces are for private functions and JvmDefault implementations.
|
||||||
// The two cannot clash.
|
// The two cannot clash.
|
||||||
parentAsClass.isJvmInterface -> if (!DescriptorVisibilities.isPrivate(visibility)) "\$jd" else ""
|
currentClass?.irElement?.let { element ->
|
||||||
|
element is IrClass && element.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS && element.parentAsClass == parentAsClass
|
||||||
|
} ?: false -> if (!DescriptorVisibilities.isPrivate(visibility)) "\$jd" else ""
|
||||||
|
|
||||||
// Accessor for _s_uper-qualified call
|
// Accessor for _s_uper-qualified call
|
||||||
superQualifier != null -> "\$s" + superQualifier.owner.syntheticAccessorToSuperSuffix()
|
superQualifier != null -> "\$s" + superQualifier.owner.syntheticAccessorToSuperSuffix()
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// CHECK_BYTECODE_LISTING
|
||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
// !JVM_DEFAULT_MODE: all-compatibility
|
||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// JVM_TARGET: 1.8
|
||||||
|
// WITH_COROUTINES
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
interface Foo {
|
||||||
|
|
||||||
|
fun bar(): String {
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FooClass : Foo {
|
||||||
|
override fun bar(): String {
|
||||||
|
return object {
|
||||||
|
fun run()= super@FooClass.bar()
|
||||||
|
}.run()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return FooClass().bar()
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
@kotlin.Metadata
|
||||||
|
public final class Foo$DefaultImpls {
|
||||||
|
// source: 'superCall.kt'
|
||||||
|
public deprecated static @java.lang.Deprecated @org.jetbrains.annotations.NotNull method bar(@org.jetbrains.annotations.NotNull p0: Foo): java.lang.String
|
||||||
|
public final inner class Foo$DefaultImpls
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public interface Foo {
|
||||||
|
// source: 'superCall.kt'
|
||||||
|
public synthetic static method access$bar$jd(p0: Foo): java.lang.String
|
||||||
|
public @org.jetbrains.annotations.NotNull method bar(): java.lang.String
|
||||||
|
public final inner class Foo$DefaultImpls
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class FooClass$bar$1 {
|
||||||
|
// source: 'superCall.kt'
|
||||||
|
enclosing method FooClass.bar()Ljava/lang/String;
|
||||||
|
synthetic final field this$0: FooClass
|
||||||
|
inner (anonymous) class FooClass$bar$1
|
||||||
|
method <init>(p0: FooClass): void
|
||||||
|
public final @org.jetbrains.annotations.NotNull method run(): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class FooClass {
|
||||||
|
// source: 'superCall.kt'
|
||||||
|
inner (anonymous) class FooClass$bar$1
|
||||||
|
public method <init>(): void
|
||||||
|
public synthetic final static method access$bar$s414358642(p0: FooClass): java.lang.String
|
||||||
|
public @org.jetbrains.annotations.NotNull method bar(): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class SuperCallKt {
|
||||||
|
// source: 'superCall.kt'
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
@kotlin.Metadata
|
||||||
|
public final class Foo$DefaultImpls {
|
||||||
|
// source: 'superCall.kt'
|
||||||
|
public deprecated static @java.lang.Deprecated @org.jetbrains.annotations.NotNull method bar(@org.jetbrains.annotations.NotNull p0: Foo): java.lang.String
|
||||||
|
public final inner class Foo$DefaultImpls
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public interface Foo {
|
||||||
|
// source: 'superCall.kt'
|
||||||
|
public synthetic static method access$bar$jd(p0: Foo): java.lang.String
|
||||||
|
public @org.jetbrains.annotations.NotNull method bar(): java.lang.String
|
||||||
|
public final inner class Foo$DefaultImpls
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class FooClass$bar$1 {
|
||||||
|
// source: 'superCall.kt'
|
||||||
|
enclosing method FooClass.bar()Ljava/lang/String;
|
||||||
|
synthetic final field this$0: FooClass
|
||||||
|
inner (anonymous) class FooClass$bar$1
|
||||||
|
method <init>(p0: FooClass): void
|
||||||
|
public final @org.jetbrains.annotations.NotNull method run(): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class FooClass {
|
||||||
|
// source: 'superCall.kt'
|
||||||
|
inner (anonymous) class FooClass$bar$1
|
||||||
|
public method <init>(): void
|
||||||
|
public synthetic final static method access$bar$s70822(p0: FooClass): java.lang.String
|
||||||
|
public @org.jetbrains.annotations.NotNull method bar(): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class SuperCallKt {
|
||||||
|
// source: 'superCall.kt'
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
+6
@@ -22092,6 +22092,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt");
|
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("superCall.kt")
|
||||||
|
public void testSuperCall() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/superCall.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("suspendFunction.kt")
|
@TestMetadata("suspendFunction.kt")
|
||||||
public void testSuspendFunction() throws Exception {
|
public void testSuspendFunction() throws Exception {
|
||||||
|
|||||||
+6
@@ -22092,6 +22092,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt");
|
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("superCall.kt")
|
||||||
|
public void testSuperCall() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/superCall.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("suspendFunction.kt")
|
@TestMetadata("suspendFunction.kt")
|
||||||
public void testSuspendFunction() throws Exception {
|
public void testSuspendFunction() throws Exception {
|
||||||
|
|||||||
+5
@@ -18596,6 +18596,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt");
|
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/simpleFunction.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("superCall.kt")
|
||||||
|
public void testSuperCall() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/superCall.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/delegationBy")
|
@TestMetadata("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/delegationBy")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user