diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForFunctionDescriptor.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForFunctionDescriptor.java index 6c5e11688c6..07b75c89b39 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForFunctionDescriptor.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForFunctionDescriptor.java @@ -31,11 +31,11 @@ public class AccessorForFunctionDescriptor extends AbstractAccessorForFunctionDe public AccessorForFunctionDescriptor( @NotNull FunctionDescriptor descriptor, @NotNull DeclarationDescriptor containingDeclaration, - int index, - @Nullable JetSuperExpression superCallExpression + @Nullable JetSuperExpression superCallExpression, + @NotNull String nameSuffix ) { super(containingDeclaration, - Name.identifier("access$" + (descriptor instanceof ConstructorDescriptor ? "init" : descriptor.getName()) + "$" + index)); + Name.identifier("access$" + nameSuffix)); this.calleeDescriptor = descriptor; this.superCallExpression = superCallExpression; diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForPropertyBackingFieldInOuterClass.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForPropertyBackingFieldInOuterClass.java index b09ba5bfce3..d072f5f0628 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForPropertyBackingFieldInOuterClass.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForPropertyBackingFieldInOuterClass.java @@ -26,9 +26,9 @@ public class AccessorForPropertyBackingFieldInOuterClass extends AccessorForProp public AccessorForPropertyBackingFieldInOuterClass( @NotNull PropertyDescriptor property, @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); } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForPropertyDescriptor.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForPropertyDescriptor.java index 8eec150c4f1..b3225ab8beb 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForPropertyDescriptor.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AccessorForPropertyDescriptor.java @@ -33,17 +33,17 @@ import java.util.Collections; public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implements AccessorForCallableDescriptor { private final PropertyDescriptor calleeDescriptor; - private final int accessorIndex; private final JetSuperExpression superCallExpression; + @NotNull private final String nameSuffix; public AccessorForPropertyDescriptor( @NotNull PropertyDescriptor property, @NotNull DeclarationDescriptor containingDeclaration, - int index, - @Nullable JetSuperExpression superCallExpression + @Nullable JetSuperExpression superCallExpression, + @NotNull String nameSuffix ) { this(property, property.getType(), DescriptorUtils.getReceiverParameterType(property.getExtensionReceiverParameter()), - property.getDispatchReceiverParameter(), containingDeclaration, index, superCallExpression); + property.getDispatchReceiverParameter(), containingDeclaration, superCallExpression, nameSuffix); } protected AccessorForPropertyDescriptor( @@ -52,16 +52,16 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem @Nullable JetType receiverType, @Nullable ReceiverParameterDescriptor dispatchReceiverParameter, @NotNull DeclarationDescriptor containingDeclaration, - int index, - @Nullable JetSuperExpression superCallExpression + @Nullable JetSuperExpression superCallExpression, + @NotNull String nameSuffix ) { 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); this.calleeDescriptor = original; - this.accessorIndex = index; this.superCallExpression = superCallExpression; + this.nameSuffix = nameSuffix; setType(propertyType, Collections.emptyList(), dispatchReceiverParameter, receiverType); initialize(new Getter(this), new Setter(this)); } @@ -85,6 +85,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem public JetSuperExpression getSuperCallExpression() { return ((AccessorForPropertyDescriptor) getCorrespondingProperty()).getSuperCallExpression(); } + } public static class Setter extends PropertySetterDescriptorImpl implements AccessorForCallableDescriptor{ @@ -120,12 +121,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem } @NotNull - public String getIndexedAccessorSuffix() { - return getIndexedAccessorSuffix(calleeDescriptor, accessorIndex); - } - - @NotNull - private static String getIndexedAccessorSuffix(@NotNull PropertyDescriptor original, int index) { - return original.getName() + "$" + index; + public String getAccessorSuffix() { + return nameSuffix; } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java index 09cae8af8d4..be1b389b026 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java @@ -303,11 +303,10 @@ public abstract class CodegenContext { accessor instanceof AccessorForPropertyBackingFieldInOuterClass : "There is already exists accessor with isForBackingFieldInOuterClass = false in this context"; return (D) accessor; } - - int accessorIndex = accessors.size(); + String nameSuffix = SyntheticAccessorUtilKt.getAccessorNameSuffix(descriptor, key.superCallLabelTarget, isForBackingFieldInOuterClass); if (descriptor instanceof SimpleFunctionDescriptor) { accessor = new AccessorForFunctionDescriptor( - (FunctionDescriptor) descriptor, contextDescriptor, accessorIndex, superCallExpression + (FunctionDescriptor) descriptor, contextDescriptor, superCallExpression, nameSuffix ); } else if (descriptor instanceof ConstructorDescriptor) { @@ -316,11 +315,11 @@ public abstract class CodegenContext { else if (descriptor instanceof PropertyDescriptor) { if (isForBackingFieldInOuterClass) { accessor = new AccessorForPropertyBackingFieldInOuterClass((PropertyDescriptor) descriptor, contextDescriptor, - accessorIndex, delegateType); + delegateType, nameSuffix); } else { accessor = new AccessorForPropertyDescriptor((PropertyDescriptor) descriptor, contextDescriptor, - accessorIndex, superCallExpression); + superCallExpression, nameSuffix); } } else { diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JetTypeMapper.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JetTypeMapper.java index 458d9ce848e..8cf160c8910 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JetTypeMapper.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JetTypeMapper.java @@ -858,7 +858,7 @@ public class JetTypeMapper { boolean isAccessor = property instanceof AccessorForPropertyDescriptor; String propertyName = isAccessor - ? ((AccessorForPropertyDescriptor) property).getIndexedAccessorSuffix() + ? ((AccessorForPropertyDescriptor) property).getAccessorSuffix() : property.getName().asString(); String accessorName = descriptor instanceof PropertyGetterDescriptor diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/syntheticAccessorUtil.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/syntheticAccessorUtil.kt new file mode 100644 index 00000000000..a9c2dfa7d95 --- /dev/null +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/syntheticAccessorUtil.kt @@ -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()}" +} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/signatureClash.kt b/compiler/testData/cli/jvm/signatureClash.kt index 7dbda49c9db..e87ea3305d9 100644 --- a/compiler/testData/cli/jvm/signatureClash.kt +++ b/compiler/testData/cli/jvm/signatureClash.kt @@ -23,7 +23,7 @@ class SubTr : Tr { // Clashing synthetic accessors are only reported in compiler, IDE doesn't see them class C { private fun f() {} - fun `access$f$0`(c: C) {} + fun `access$f`(c: C) {} class Nested { diff --git a/compiler/testData/cli/jvm/signatureClash.out b/compiler/testData/cli/jvm/signatureClash.out index 276366d3220..3c8e1e95f9f 100644 --- a/compiler/testData/cli/jvm/signatureClash.out +++ b/compiler/testData/cli/jvm/signatureClash.out @@ -33,14 +33,14 @@ compiler/testData/cli/jvm/signatureClash.kt:20:5: error: platform declaration cl fun getTr(): kotlin.Int 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): - fun `access$f$0`(c: C): kotlin.Unit +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`(c: C): kotlin.Unit fun f(): kotlin.Unit 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): - fun `access$f$0`(c: C): kotlin.Unit +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`(c: C): kotlin.Unit fun f(): kotlin.Unit - fun `access$f$0`(c: C) {} + fun `access$f`(c: C) {} ^ -COMPILATION_ERROR +COMPILATION_ERROR \ No newline at end of file diff --git a/compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.args b/compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.args new file mode 100644 index 00000000000..2fa85939740 --- /dev/null +++ b/compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.args @@ -0,0 +1,3 @@ +$TESTDATA_DIR$/syntheticAccessorForPropertiesSignatureClash.kt +-d +$TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt b/compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt new file mode 100644 index 00000000000..4c92d47bbc6 --- /dev/null +++ b/compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.kt @@ -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 + }() + } +} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.out b/compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.out new file mode 100644 index 00000000000..4c417c140ea --- /dev/null +++ b/compiler/testData/cli/jvm/syntheticAccessorForPropertiesSignatureClash.out @@ -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 (: 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 (): 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 (: 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 (): 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 (): 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 (: 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 (): 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 (: 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 (: 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 (): 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 (): 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 (: kotlin.Int): kotlin.Unit + fun `access$setFoo$p`(p: A.Companion, d: Int) {} + ^ +COMPILATION_ERROR \ No newline at end of file diff --git a/compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.args b/compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.args new file mode 100644 index 00000000000..540b43a0373 --- /dev/null +++ b/compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.args @@ -0,0 +1,3 @@ +$TESTDATA_DIR$/syntheticAccessorPropertyAndFunSignatureClash.kt +-d +$TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt b/compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt new file mode 100644 index 00000000000..bef9f3bdcfb --- /dev/null +++ b/compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.kt @@ -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(); + }() + } +} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.out b/compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.out new file mode 100644 index 00000000000..8ea2a1342f4 --- /dev/null +++ b/compiler/testData/cli/jvm/syntheticAccessorPropertyAndFunSignatureClash.out @@ -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 (): 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 (: 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 (): 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 (: 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 \ No newline at end of file diff --git a/compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt b/compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt index 286cdef16be..9e43ff59b2e 100644 --- a/compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt +++ b/compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt @@ -1,14 +1,14 @@ 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$setBar$1`(d: Derived, i: Int) {} + open fun `access$getBar$p`(d: Derived): Int = 1 + 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() { diff --git a/compiler/testData/cli/jvm/syntheticAccessorSignatureClash.out b/compiler/testData/cli/jvm/syntheticAccessorSignatureClash.out index 2580a9339ed..6ac970558dc 100644 --- a/compiler/testData/cli/jvm/syntheticAccessorSignatureClash.out +++ b/compiler/testData/cli/jvm/syntheticAccessorSignatureClash.out @@ -1,31 +1,31 @@ -compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt:15:5: error: accidental override: The following declarations have the same JVM signature (access$foo$0(LDerived;)V): - fun `access$foo$0`(d: Derived): kotlin.Unit +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`(d: Derived): kotlin.Unit fun foo(): kotlin.Unit 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): - fun `access$getBar$1`(d: Derived): kotlin.Int +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$p`(d: Derived): kotlin.Int fun (): kotlin.Int 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): - fun `access$setBar$1`(d: Derived, i: kotlin.Int): kotlin.Unit +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$p`(d: Derived, i: kotlin.Int): kotlin.Unit fun (: kotlin.Int): kotlin.Unit 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): - fun `access$getBaz$2`(d: Derived): kotlin.Int +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$p`(d: Derived): kotlin.Int fun (): kotlin.Int 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): - fun `access$getBoo$3`(d: Derived): kotlin.Int +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$p`(d: Derived): kotlin.Int fun (): kotlin.Int 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): - fun `access$setBar1$4`(d: Derived, i: kotlin.Int): kotlin.Unit +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$p`(d: Derived, i: kotlin.Int): kotlin.Unit fun (: kotlin.Int): kotlin.Unit set ^ -COMPILATION_ERROR +COMPILATION_ERROR \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/cli/KotlincExecutableTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cli/KotlincExecutableTestGenerated.java index c25dbf21b7c..ed964a58543 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/KotlincExecutableTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/cli/KotlincExecutableTestGenerated.java @@ -217,6 +217,18 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes 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") public void testSyntheticAccessorSignatureClash() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/jvm/syntheticAccessorSignatureClash.args"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/MethodOrderTest.kt b/compiler/tests/org/jetbrains/kotlin/codegen/MethodOrderTest.kt index c32a931669f..719813b99dc 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/MethodOrderTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/codegen/MethodOrderTest.kt @@ -99,10 +99,10 @@ public class MethodOrderTest: CodegenTestCase() { listOf( "c()V", "(ILjava/lang/String;)V", - "access\$getB$0(LOuter;)Ljava/lang/String;", - "access\$setB$0(LOuter;Ljava/lang/String;)V", - "access\$getA$1(LOuter;)I", - "access\$c$2(LOuter;)V" + "access\$getB\$p(LOuter;)Ljava/lang/String;", + "access\$setB\$p(LOuter;Ljava/lang/String;)V", + "access\$getA\$p(LOuter;)I", + "access\$c(LOuter;)V" ) ) }