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
+1 -1
View File
@@ -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 {
+6 -6
View File
@@ -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
@@ -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 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() {
+13 -13
View File
@@ -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 <get-bar>(): 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 <set-bar>(<set-?>: 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 <get-baz>(): 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 <get-boo>(): 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 <set-bar1>(<set-?>: kotlin.Int): kotlin.Unit
set
^
COMPILATION_ERROR
COMPILATION_ERROR