Reporting ACCIDENTAL_OVERRIDE on jvm signatures that have no descriptors

(marking them SYNTHETIC)
This commit is contained in:
Andrey Breslav
2014-09-10 13:21:24 +04:00
committed by Michael Bogdanov
parent 9b7bccce22
commit b8b0316d97
19 changed files with 189 additions and 27 deletions
@@ -0,0 +1,3 @@
$TESTDATA_DIR$/syntheticAccessorSignatureClash.kt
-d
$TEMP_DIR$
@@ -0,0 +1,38 @@
open class Base {
open fun `foo$b$0`(d: Derived) {}
open fun `getBar$b$1`(d: Derived): Int = 1
open fun `setBar$b$1`(d: Derived, i: Int) {}
open fun `getBaz$b$2`(d: Derived): Int = 1
open fun `getBoo$b$3`(d: Derived): Int = 1
open fun `setBar1$b$4`(d: Derived, i: Int) {}
}
class Derived : Base() {
private fun foo() {}
private var bar = 1
get
set
private var baz = 1
private val boo = 1
private var bar1 = 1
get
set
inner class Nested {
fun test() {
foo()
bar += 1
baz += 1
val s = boo
bar1 += 1
}
}
}
@@ -0,0 +1,20 @@
WARNING: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (34, 17) Variable 's' is never used
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (15, 5) Accidental override: The following declarations have the same JVM signature (foo$b$0(LDerived;)V):
fun foo$b$0(d: Derived): kotlin.Unit
fun foo(): kotlin.Unit
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (18, 9) Accidental override: The following declarations have the same JVM signature (getBar$b$1(LDerived;)I):
fun getBar$b$1(d: Derived): kotlin.Int
fun <get-bar>(): kotlin.Int
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (19, 9) Accidental override: The following declarations have the same JVM signature (setBar$b$1(LDerived;I)V):
fun setBar$b$1(d: Derived, i: kotlin.Int): kotlin.Unit
fun <set-bar>(<set-?>: kotlin.Int): kotlin.Unit
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (21, 5) Accidental override: The following declarations have the same JVM signature (getBaz$b$2(LDerived;)I):
fun getBaz$b$2(d: Derived): kotlin.Int
fun <get-baz>(): kotlin.Int
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (23, 5) Accidental override: The following declarations have the same JVM signature (getBoo$b$3(LDerived;)I):
fun getBoo$b$3(d: Derived): kotlin.Int
fun <get-boo>(): kotlin.Int
ERROR: compiler/testData/cli/jvm/syntheticAccessorSignatureClash.kt: (27, 9) Accidental override: The following declarations have the same JVM signature (setBar1$b$4(LDerived;I)V):
fun setBar1$b$4(d: Derived, i: kotlin.Int): kotlin.Unit
fun <set-bar1>(<set-?>: kotlin.Int): kotlin.Unit
COMPILATION_ERROR