Stable accessors names

This commit is contained in:
Michael Bogdanov
2015-10-15 17:25:49 +03:00
committed by Max Kammerer
parent 7851abd535
commit 01864801f3
18 changed files with 263 additions and 57 deletions
@@ -31,11 +31,11 @@ public class AccessorForFunctionDescriptor extends AbstractAccessorForFunctionDe
public AccessorForFunctionDescriptor( public AccessorForFunctionDescriptor(
@NotNull FunctionDescriptor descriptor, @NotNull FunctionDescriptor descriptor,
@NotNull DeclarationDescriptor containingDeclaration, @NotNull DeclarationDescriptor containingDeclaration,
int index, @Nullable JetSuperExpression superCallExpression,
@Nullable JetSuperExpression superCallExpression @NotNull String nameSuffix
) { ) {
super(containingDeclaration, super(containingDeclaration,
Name.identifier("access$" + (descriptor instanceof ConstructorDescriptor ? "init" : descriptor.getName()) + "$" + index)); Name.identifier("access$" + nameSuffix));
this.calleeDescriptor = descriptor; this.calleeDescriptor = descriptor;
this.superCallExpression = superCallExpression; this.superCallExpression = superCallExpression;
@@ -26,9 +26,9 @@ public class AccessorForPropertyBackingFieldInOuterClass extends AccessorForProp
public AccessorForPropertyBackingFieldInOuterClass( public AccessorForPropertyBackingFieldInOuterClass(
@NotNull PropertyDescriptor property, @NotNull PropertyDescriptor property,
@NotNull DeclarationDescriptor containingDeclaration, @NotNull DeclarationDescriptor containingDeclaration,
int index, @Nullable JetType delegationType,
@Nullable JetType delegationType @NotNull String nameSuffix
) { ) {
super(property, delegationType != null ? delegationType : property.getType(), null, null, containingDeclaration, index, null); super(property, delegationType != null ? delegationType : property.getType(), null, null, containingDeclaration, null, nameSuffix);
} }
} }
@@ -33,17 +33,17 @@ import java.util.Collections;
public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implements AccessorForCallableDescriptor<PropertyDescriptor> { public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implements AccessorForCallableDescriptor<PropertyDescriptor> {
private final PropertyDescriptor calleeDescriptor; private final PropertyDescriptor calleeDescriptor;
private final int accessorIndex;
private final JetSuperExpression superCallExpression; private final JetSuperExpression superCallExpression;
@NotNull private final String nameSuffix;
public AccessorForPropertyDescriptor( public AccessorForPropertyDescriptor(
@NotNull PropertyDescriptor property, @NotNull PropertyDescriptor property,
@NotNull DeclarationDescriptor containingDeclaration, @NotNull DeclarationDescriptor containingDeclaration,
int index, @Nullable JetSuperExpression superCallExpression,
@Nullable JetSuperExpression superCallExpression @NotNull String nameSuffix
) { ) {
this(property, property.getType(), DescriptorUtils.getReceiverParameterType(property.getExtensionReceiverParameter()), this(property, property.getType(), DescriptorUtils.getReceiverParameterType(property.getExtensionReceiverParameter()),
property.getDispatchReceiverParameter(), containingDeclaration, index, superCallExpression); property.getDispatchReceiverParameter(), containingDeclaration, superCallExpression, nameSuffix);
} }
protected AccessorForPropertyDescriptor( protected AccessorForPropertyDescriptor(
@@ -52,16 +52,16 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
@Nullable JetType receiverType, @Nullable JetType receiverType,
@Nullable ReceiverParameterDescriptor dispatchReceiverParameter, @Nullable ReceiverParameterDescriptor dispatchReceiverParameter,
@NotNull DeclarationDescriptor containingDeclaration, @NotNull DeclarationDescriptor containingDeclaration,
int index, @Nullable JetSuperExpression superCallExpression,
@Nullable JetSuperExpression superCallExpression @NotNull String nameSuffix
) { ) {
super(containingDeclaration, null, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL, super(containingDeclaration, null, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL,
original.isVar(), Name.identifier("access$" + getIndexedAccessorSuffix(original, index)), original.isVar(), Name.identifier("access$" + nameSuffix),
Kind.DECLARATION, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false); Kind.DECLARATION, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false);
this.calleeDescriptor = original; this.calleeDescriptor = original;
this.accessorIndex = index;
this.superCallExpression = superCallExpression; this.superCallExpression = superCallExpression;
this.nameSuffix = nameSuffix;
setType(propertyType, Collections.<TypeParameterDescriptorImpl>emptyList(), dispatchReceiverParameter, receiverType); setType(propertyType, Collections.<TypeParameterDescriptorImpl>emptyList(), dispatchReceiverParameter, receiverType);
initialize(new Getter(this), new Setter(this)); initialize(new Getter(this), new Setter(this));
} }
@@ -85,6 +85,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
public JetSuperExpression getSuperCallExpression() { public JetSuperExpression getSuperCallExpression() {
return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getSuperCallExpression(); return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getSuperCallExpression();
} }
} }
public static class Setter extends PropertySetterDescriptorImpl implements AccessorForCallableDescriptor<PropertySetterDescriptor>{ public static class Setter extends PropertySetterDescriptorImpl implements AccessorForCallableDescriptor<PropertySetterDescriptor>{
@@ -120,12 +121,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
} }
@NotNull @NotNull
public String getIndexedAccessorSuffix() { public String getAccessorSuffix() {
return getIndexedAccessorSuffix(calleeDescriptor, accessorIndex); return nameSuffix;
}
@NotNull
private static String getIndexedAccessorSuffix(@NotNull PropertyDescriptor original, int index) {
return original.getName() + "$" + index;
} }
} }
@@ -303,11 +303,10 @@ public abstract class CodegenContext<T extends DeclarationDescriptor> {
accessor instanceof AccessorForPropertyBackingFieldInOuterClass : "There is already exists accessor with isForBackingFieldInOuterClass = false in this context"; accessor instanceof AccessorForPropertyBackingFieldInOuterClass : "There is already exists accessor with isForBackingFieldInOuterClass = false in this context";
return (D) accessor; return (D) accessor;
} }
String nameSuffix = SyntheticAccessorUtilKt.getAccessorNameSuffix(descriptor, key.superCallLabelTarget, isForBackingFieldInOuterClass);
int accessorIndex = accessors.size();
if (descriptor instanceof SimpleFunctionDescriptor) { if (descriptor instanceof SimpleFunctionDescriptor) {
accessor = new AccessorForFunctionDescriptor( accessor = new AccessorForFunctionDescriptor(
(FunctionDescriptor) descriptor, contextDescriptor, accessorIndex, superCallExpression (FunctionDescriptor) descriptor, contextDescriptor, superCallExpression, nameSuffix
); );
} }
else if (descriptor instanceof ConstructorDescriptor) { else if (descriptor instanceof ConstructorDescriptor) {
@@ -316,11 +315,11 @@ public abstract class CodegenContext<T extends DeclarationDescriptor> {
else if (descriptor instanceof PropertyDescriptor) { else if (descriptor instanceof PropertyDescriptor) {
if (isForBackingFieldInOuterClass) { if (isForBackingFieldInOuterClass) {
accessor = new AccessorForPropertyBackingFieldInOuterClass((PropertyDescriptor) descriptor, contextDescriptor, accessor = new AccessorForPropertyBackingFieldInOuterClass((PropertyDescriptor) descriptor, contextDescriptor,
accessorIndex, delegateType); delegateType, nameSuffix);
} }
else { else {
accessor = new AccessorForPropertyDescriptor((PropertyDescriptor) descriptor, contextDescriptor, accessor = new AccessorForPropertyDescriptor((PropertyDescriptor) descriptor, contextDescriptor,
accessorIndex, superCallExpression); superCallExpression, nameSuffix);
} }
} }
else { else {
@@ -858,7 +858,7 @@ public class JetTypeMapper {
boolean isAccessor = property instanceof AccessorForPropertyDescriptor; boolean isAccessor = property instanceof AccessorForPropertyDescriptor;
String propertyName = isAccessor String propertyName = isAccessor
? ((AccessorForPropertyDescriptor) property).getIndexedAccessorSuffix() ? ((AccessorForPropertyDescriptor) property).getAccessorSuffix()
: property.getName().asString(); : property.getName().asString();
String accessorName = descriptor instanceof PropertyGetterDescriptor String accessorName = descriptor instanceof PropertyGetterDescriptor
@@ -0,0 +1,34 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.descriptors.*
fun getAccessorNameSuffix(descriptor: CallableMemberDescriptor, superCallDescriptor: ClassDescriptor?, isForBackingFieldInOuterClass: Boolean): String {
val suffix = when (descriptor) {
is ConstructorDescriptor ->
return "will be ignored"
is SimpleFunctionDescriptor ->
descriptor.name.asString()
is PropertyDescriptor ->
descriptor.name.asString() + "$" + (if (isForBackingFieldInOuterClass) "cp" else "p")
else ->
throw UnsupportedOperationException("Do not know how to create accessor for descriptor " + descriptor)
}
return if (superCallDescriptor == null) suffix else "$suffix\$s${superCallDescriptor.name.asString().hashCode()}"
}
+1 -1
View File
@@ -23,7 +23,7 @@ class SubTr : Tr {
// Clashing synthetic accessors are only reported in compiler, IDE doesn't see them // Clashing synthetic accessors are only reported in compiler, IDE doesn't see them
class C { class C {
private fun f() {} private fun f() {}
fun `access$f$0`(c: C) {} fun `access$f`(c: C) {}
class Nested { class Nested {
+5 -5
View File
@@ -33,14 +33,14 @@ compiler/testData/cli/jvm/signatureClash.kt:20:5: error: platform declaration cl
fun getTr(): kotlin.Int fun getTr(): kotlin.Int
val tr = 1 val tr = 1
^ ^
compiler/testData/cli/jvm/signatureClash.kt:24:7: error: platform declaration clash: The following declarations have the same JVM signature (access$f$0(LC;)V): compiler/testData/cli/jvm/signatureClash.kt:24:7: error: platform declaration clash: The following declarations have the same JVM signature (access$f(LC;)V):
fun `access$f$0`(c: C): kotlin.Unit fun `access$f`(c: C): kotlin.Unit
fun f(): kotlin.Unit fun f(): kotlin.Unit
class C { class C {
^ ^
compiler/testData/cli/jvm/signatureClash.kt:26:5: error: platform declaration clash: The following declarations have the same JVM signature (access$f$0(LC;)V): compiler/testData/cli/jvm/signatureClash.kt:26:5: error: platform declaration clash: The following declarations have the same JVM signature (access$f(LC;)V):
fun `access$f$0`(c: C): kotlin.Unit fun `access$f`(c: C): kotlin.Unit
fun f(): kotlin.Unit fun f(): kotlin.Unit
fun `access$f$0`(c: C) {} fun `access$f`(c: C) {}
^ ^
COMPILATION_ERROR COMPILATION_ERROR
@@ -0,0 +1,3 @@
$TESTDATA_DIR$/syntheticAccessorForPropertiesSignatureClash.kt
-d
$TEMP_DIR$
@@ -0,0 +1,32 @@
class A {
private var foo = 1;
fun `access$getFoo$p`(a: A): Int = 1
fun `access$setFoo$p`(a: A, d: Int) {}
//companion backing field accessors
fun `access$getFoo$cp`(): Int = 1
fun `access$setFoo$cp`(d: Int) {}
companion object {
private var foo = 1;
fun test() {
{
foo = 2;
foo
}()
}
fun `access$getFoo$p`(p: A.Companion): Int = 1
fun `access$setFoo$p`(p: A.Companion, d: Int) {}
}
fun test() {
{
foo = 2;
foo
}()
}
}
@@ -0,0 +1,61 @@
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
fun `access$setFoo$p`(a: A, d: kotlin.Int): kotlin.Unit
fun <set-foo>(<set-?>: kotlin.Int): kotlin.Unit
class A {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
fun `access$getFoo$p`(a: A): kotlin.Int
fun <get-foo>(): kotlin.Int
class A {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$cp(I)V):
fun `access$setFoo$cp`(d: kotlin.Int): kotlin.Unit
fun <set-foo>(<set-?>: kotlin.Int): kotlin.Unit
class A {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$cp()I):
fun `access$getFoo$cp`(): kotlin.Int
fun <get-foo>(): kotlin.Int
class A {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:5:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
fun `access$getFoo$p`(a: A): kotlin.Int
fun <get-foo>(): kotlin.Int
fun `access$getFoo$p`(a: A): Int = 1
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:6:5: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
fun `access$setFoo$p`(a: A, d: kotlin.Int): kotlin.Unit
fun <set-foo>(<set-?>: kotlin.Int): kotlin.Unit
fun `access$setFoo$p`(a: A, d: Int) {}
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:9:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$cp()I):
fun `access$getFoo$cp`(): kotlin.Int
fun <get-foo>(): kotlin.Int
fun `access$getFoo$cp`(): Int = 1
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:10:5: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$cp(I)V):
fun `access$setFoo$cp`(d: kotlin.Int): kotlin.Unit
fun <set-foo>(<set-?>: kotlin.Int): kotlin.Unit
fun `access$setFoo$cp`(d: Int) {}
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:12:15: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA$Companion;I)V):
fun `access$setFoo$p`(p: A.Companion, d: kotlin.Int): kotlin.Unit
fun <set-foo>(<set-?>: kotlin.Int): kotlin.Unit
companion object {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:12:15: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA$Companion;)I):
fun `access$getFoo$p`(p: A.Companion): kotlin.Int
fun <get-foo>(): kotlin.Int
companion object {
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:22:9: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA$Companion;)I):
fun `access$getFoo$p`(p: A.Companion): kotlin.Int
fun <get-foo>(): kotlin.Int
fun `access$getFoo$p`(p: A.Companion): Int = 1
^
compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt:23:9: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA$Companion;I)V):
fun `access$setFoo$p`(p: A.Companion, d: kotlin.Int): kotlin.Unit
fun <set-foo>(<set-?>: kotlin.Int): kotlin.Unit
fun `access$setFoo$p`(p: A.Companion, d: Int) {}
^
COMPILATION_ERROR
@@ -0,0 +1,3 @@
$TESTDATA_DIR$/syntheticAccessorPropertyAndFunSignatureClash.kt
-d
$TEMP_DIR$
@@ -0,0 +1,25 @@
class A {
private var foo = 1;
fun `access$getFoo$p`(a: A): Int = 1
fun `access$setFoo$p`(a: A, d: Int) {}
private fun getFoo() = 1;
private fun setFoo(i: Int) {}
fun `access$getFoo`(a: A): Int = 1
fun `access$setFoo`(a: A, d: Int) {}
fun test() {
{
foo = 2;
foo
}();
{
setFoo(2)
getFoo();
}()
}
}
@@ -0,0 +1,41 @@
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo(LA;)I):
fun `access$getFoo`(a: A): kotlin.Int
fun getFoo(): kotlin.Int
class A {
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo(LA;I)V):
fun `access$setFoo`(a: A, d: kotlin.Int): kotlin.Unit
fun setFoo(i: kotlin.Int): kotlin.Unit
class A {
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
fun `access$getFoo$p`(a: A): kotlin.Int
fun <get-foo>(): kotlin.Int
class A {
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:1:7: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
fun `access$setFoo$p`(a: A, d: kotlin.Int): kotlin.Unit
fun <set-foo>(<set-?>: kotlin.Int): kotlin.Unit
class A {
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:5:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo$p(LA;)I):
fun `access$getFoo$p`(a: A): kotlin.Int
fun <get-foo>(): kotlin.Int
fun `access$getFoo$p`(a: A): Int = 1
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:6:5: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo$p(LA;I)V):
fun `access$setFoo$p`(a: A, d: kotlin.Int): kotlin.Unit
fun <set-foo>(<set-?>: kotlin.Int): kotlin.Unit
fun `access$setFoo$p`(a: A, d: Int) {}
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:11:5: error: platform declaration clash: The following declarations have the same JVM signature (access$getFoo(LA;)I):
fun `access$getFoo`(a: A): kotlin.Int
fun getFoo(): kotlin.Int
fun `access$getFoo`(a: A): Int = 1
^
compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt:12:5: error: platform declaration clash: The following declarations have the same JVM signature (access$setFoo(LA;I)V):
fun `access$setFoo`(a: A, d: kotlin.Int): kotlin.Unit
fun setFoo(i: kotlin.Int): kotlin.Unit
fun `access$setFoo`(a: A, d: Int) {}
^
COMPILATION_ERROR
@@ -1,14 +1,14 @@
open class Base { open class Base {
open fun `access$foo$0`(d: Derived) {} open fun `access$foo`(d: Derived) {}
open fun `access$getBar$1`(d: Derived): Int = 1 open fun `access$getBar$p`(d: Derived): Int = 1
open fun `access$setBar$1`(d: Derived, i: Int) {} open fun `access$setBar$p`(d: Derived, i: Int) {}
open fun `access$getBaz$2`(d: Derived): Int = 1 open fun `access$getBaz$p`(d: Derived): Int = 1
open fun `access$getBoo$3`(d: Derived): Int = 1 open fun `access$getBoo$p`(d: Derived): Int = 1
open fun `access$setBar1$4`(d: Derived, i: Int) {} open fun `access$setBar1$p`(d: Derived, i: Int) {}
} }
class Derived : Base() { class Derived : Base() {
+12 -12
View File
@@ -1,30 +1,30 @@
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:15:5: error: accidental override: The following declarations have the same JVM signature (access$foo$0(LDerived;)V): compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:15:5: error: accidental override: The following declarations have the same JVM signature (access$foo(LDerived;)V):
fun `access$foo$0`(d: Derived): kotlin.Unit fun `access$foo`(d: Derived): kotlin.Unit
fun foo(): kotlin.Unit fun foo(): kotlin.Unit
private fun foo() {} private fun foo() {}
^ ^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:18:9: error: accidental override: The following declarations have the same JVM signature (access$getBar$1(LDerived;)I): compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:18:9: error: accidental override: The following declarations have the same JVM signature (access$getBar$p(LDerived;)I):
fun `access$getBar$1`(d: Derived): kotlin.Int fun `access$getBar$p`(d: Derived): kotlin.Int
fun <get-bar>(): kotlin.Int fun <get-bar>(): kotlin.Int
get get
^ ^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:19:9: error: accidental override: The following declarations have the same JVM signature (access$setBar$1(LDerived;I)V): compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:19:9: error: accidental override: The following declarations have the same JVM signature (access$setBar$p(LDerived;I)V):
fun `access$setBar$1`(d: Derived, i: kotlin.Int): kotlin.Unit fun `access$setBar$p`(d: Derived, i: kotlin.Int): kotlin.Unit
fun <set-bar>(<set-?>: kotlin.Int): kotlin.Unit fun <set-bar>(<set-?>: kotlin.Int): kotlin.Unit
set set
^ ^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:21:5: error: accidental override: The following declarations have the same JVM signature (access$getBaz$2(LDerived;)I): compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:21:5: error: accidental override: The following declarations have the same JVM signature (access$getBaz$p(LDerived;)I):
fun `access$getBaz$2`(d: Derived): kotlin.Int fun `access$getBaz$p`(d: Derived): kotlin.Int
fun <get-baz>(): kotlin.Int fun <get-baz>(): kotlin.Int
private var baz = 1 private var baz = 1
^ ^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:23:5: error: accidental override: The following declarations have the same JVM signature (access$getBoo$3(LDerived;)I): compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:23:5: error: accidental override: The following declarations have the same JVM signature (access$getBoo$p(LDerived;)I):
fun `access$getBoo$3`(d: Derived): kotlin.Int fun `access$getBoo$p`(d: Derived): kotlin.Int
fun <get-boo>(): kotlin.Int fun <get-boo>(): kotlin.Int
private val boo = 1 private val boo = 1
^ ^
compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:27:9: error: accidental override: The following declarations have the same JVM signature (access$setBar1$4(LDerived;I)V): compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:27:9: error: accidental override: The following declarations have the same JVM signature (access$setBar1$p(LDerived;I)V):
fun `access$setBar1$4`(d: Derived, i: kotlin.Int): kotlin.Unit fun `access$setBar1$p`(d: Derived, i: kotlin.Int): kotlin.Unit
fun <set-bar1>(<set-?>: kotlin.Int): kotlin.Unit fun <set-bar1>(<set-?>: kotlin.Int): kotlin.Unit
set set
^ ^
@@ -217,6 +217,18 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes
doJvmTest(fileName); doJvmTest(fileName);
} }
@TestMetadata("syntheticAccessorForPropertiesSignatureClash.args")
public void testSyntheticAccessorForPropertiesSignatureClash() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.args");
doJvmTest(fileName);
}
@TestMetadata("syntheticAccessorPropertyAndFunSignatureClash.args")
public void testSyntheticAccessorPropertyAndFunSignatureClash() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.args");
doJvmTest(fileName);
}
@TestMetadata("syntheticAccessorSignatureClash.args") @TestMetadata("syntheticAccessorSignatureClash.args")
public void testSyntheticAccessorSignatureClash() throws Exception { public void testSyntheticAccessorSignatureClash() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/syntheticAccessorSignatureClash.args"); String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/syntheticAccessorSignatureClash.args");
@@ -99,10 +99,10 @@ public class MethodOrderTest: CodegenTestCase() {
listOf( listOf(
"c()V", "c()V",
"<init>(ILjava/lang/String;)V", "<init>(ILjava/lang/String;)V",
"access\$getB$0(LOuter;)Ljava/lang/String;", "access\$getB\$p(LOuter;)Ljava/lang/String;",
"access\$setB$0(LOuter;Ljava/lang/String;)V", "access\$setB\$p(LOuter;Ljava/lang/String;)V",
"access\$getA$1(LOuter;)I", "access\$getA\$p(LOuter;)I",
"access\$c$2(LOuter;)V" "access\$c(LOuter;)V"
) )
) )
} }