Tests for some more cases of JVM signature clashes

This commit is contained in:
Andrey Breslav
2014-06-20 15:51:47 +04:00
parent e2c5d9edf6
commit 64175d3996
6 changed files with 49 additions and 0 deletions
@@ -19,3 +19,16 @@ trait Tr {
class SubTr : Tr {
val tr = 1
}
// Clashing synthetic accessors are only reported in compiler, IDE doesn't see them
class C {
private fun f() {}
fun `f$b$0`(c: C) {}
class Nested {
fun test() {
C().f()
}
}
}
@@ -1,3 +1,4 @@
WARNING: $TESTDATA_DIR$/signatureClash.kt: (26, 17) Parameter 'c' is never used
ERROR: $TESTDATA_DIR$/signatureClash.kt: (6, 5) Accidental override: The following declarations have the same JVM signature (getX()I):
fun getX(): kotlin.Int
fun <get-x>(): kotlin.Int
@@ -19,4 +20,10 @@ ERROR: $TESTDATA_DIR$/signatureClash.kt: (16, 5) Platform declaration clash: The
ERROR: $TESTDATA_DIR$/signatureClash.kt: (20, 5) Platform declaration clash: The following declarations have the same JVM signature (getTr()I):
fun <get-tr>(): kotlin.Int
fun getTr(): kotlin.Int
ERROR: $TESTDATA_DIR$/signatureClash.kt: (24, 7) Platform declaration clash: The following declarations have the same JVM signature (f$b$0(LC;)V):
fun f$b$0(c: C): kotlin.Unit
fun f(): kotlin.Unit
ERROR: $TESTDATA_DIR$/signatureClash.kt: (26, 5) Platform declaration clash: The following declarations have the same JVM signature (f$b$0(LC;)V):
fun f$b$0(c: C): kotlin.Unit
fun f(): kotlin.Unit
COMPILATION_ERROR
@@ -0,0 +1,2 @@
<!CONFLICTING_JVM_DECLARATIONS!>val aa<!> = 1
<!CONFLICTING_JVM_DECLARATIONS!>val Aa<!> = 1
@@ -0,0 +1,7 @@
class G<T>
val <T> G<T>.foo: Int
<!CONFLICTING_JVM_DECLARATIONS!>get()<!> = 1
val G<String>.foo: Int
<!CONFLICTING_JVM_DECLARATIONS!>get()<!> = 1
@@ -0,0 +1,5 @@
<!CONFLICTING_OVERLOADS!>fun foo(vararg <!UNUSED_PARAMETER!>x<!>: Int)<!> {}
<!CONFLICTING_OVERLOADS!>fun foo(<!UNUSED_PARAMETER!>x<!>: IntArray)<!> {}
<!CONFLICTING_JVM_DECLARATIONS!>fun foo(vararg <!UNUSED_PARAMETER!>x<!>: Int?)<!> {}
<!CONFLICTING_JVM_DECLARATIONS!>fun foo(<!UNUSED_PARAMETER!>x<!>: Array<Int>)<!> {}
@@ -2552,11 +2552,21 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/diagnostics/tests/duplicateJvmSignature"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("caseInProperties.kt")
public void testCaseInProperties() throws Exception {
doTest("compiler/testData/diagnostics/tests/duplicateJvmSignature/caseInProperties.kt");
}
@TestMetadata("missingNames.kt")
public void testMissingNames() throws Exception {
doTest("compiler/testData/diagnostics/tests/duplicateJvmSignature/missingNames.kt");
}
@TestMetadata("vararg.kt")
public void testVararg() throws Exception {
doTest("compiler/testData/diagnostics/tests/duplicateJvmSignature/vararg.kt");
}
@TestMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature/accidentalOverrides")
public static class AccidentalOverrides extends AbstractJetDiagnosticsTest {
public void testAllFilesPresentInAccidentalOverrides() throws Exception {
@@ -2689,6 +2699,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest("compiler/testData/diagnostics/tests/duplicateJvmSignature/erasure/delegationAndOwnMethod.kt");
}
@TestMetadata("extensionProperties.kt")
public void testExtensionProperties() throws Exception {
doTest("compiler/testData/diagnostics/tests/duplicateJvmSignature/erasure/extensionProperties.kt");
}
@TestMetadata("genericType.kt")
public void testGenericType() throws Exception {
doTest("compiler/testData/diagnostics/tests/duplicateJvmSignature/erasure/genericType.kt");