JS: do not report declaration clash when common redeclaration diagnostic applies. See KT-14577
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// FILE: first.kt
|
||||
package foo
|
||||
|
||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>A<!>
|
||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>C<!>
|
||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>C<!>
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun f(): Int<!> = 23
|
||||
<!CONFLICTING_OVERLOADS!>fun f(): Int<!> = 99
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun g(): String<!> = "23"
|
||||
<!CONFLICTING_OVERLOADS!>fun g(): Int<!> = 23
|
||||
|
||||
val <!REDECLARATION!>x<!>: Int = 42
|
||||
val <!REDECLARATION!>x<!>: Int = 99
|
||||
|
||||
val <!REDECLARATION!>y<!>: String = "42"
|
||||
val <!REDECLARATION!>y<!>: Int = 42
|
||||
|
||||
class B {
|
||||
<!CONFLICTING_OVERLOADS!>fun f(): Int<!> = 23
|
||||
<!CONFLICTING_OVERLOADS!>fun f(): Int<!> = 99
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun g(): String<!> = "23"
|
||||
<!CONFLICTING_OVERLOADS!>fun g(): Int<!> = 23
|
||||
|
||||
val <!REDECLARATION!>x<!>: Int = 42
|
||||
val <!REDECLARATION!>x<!>: Int = 99
|
||||
|
||||
val <!REDECLARATION!>y<!>: String = "42"
|
||||
val <!REDECLARATION!>y<!>: Int = 42
|
||||
}
|
||||
|
||||
// FILE: second.kt
|
||||
package foo
|
||||
|
||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>A<!>
|
||||
@@ -0,0 +1,55 @@
|
||||
package
|
||||
|
||||
package foo {
|
||||
public val x: kotlin.Int = 42
|
||||
public val x: kotlin.Int = 99
|
||||
public val y: kotlin.Int = 42
|
||||
public val y: kotlin.String = "42"
|
||||
public fun f(): kotlin.Int
|
||||
public fun f(): kotlin.Int
|
||||
public fun g(): kotlin.Int
|
||||
public fun g(): kotlin.String
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class B {
|
||||
public constructor B()
|
||||
public final val x: kotlin.Int = 42
|
||||
public final val x: kotlin.Int = 99
|
||||
public final val y: kotlin.Int = 42
|
||||
public final val y: kotlin.String = "42"
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun f(): kotlin.Int
|
||||
public final fun f(): kotlin.Int
|
||||
public final fun g(): kotlin.Int
|
||||
public final fun g(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class C {
|
||||
public constructor C()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class C {
|
||||
public constructor C()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
@@ -428,6 +428,12 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("declarationClash.kt")
|
||||
public void testDeclarationClash() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/name/declarationClash.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionPropertyAndMethod.kt")
|
||||
public void testExtensionPropertyAndMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/name/extensionPropertyAndMethod.kt");
|
||||
|
||||
Reference in New Issue
Block a user