[FIR] Implement PACKAGE_OR_CLASSIFIER_REDECLARATION
Fix REDECLARATION positioning
This commit is contained in:
-20
@@ -1,20 +0,0 @@
|
||||
// !DIAGNOSTICS: -DUPLICATE_CLASS_NAMES
|
||||
package test
|
||||
|
||||
class A {
|
||||
<!REDECLARATION!>object Companion<!>
|
||||
|
||||
companion <!REDECLARATION!>object<!>
|
||||
}
|
||||
|
||||
class B {
|
||||
companion <!REDECLARATION!>object Named<!>
|
||||
|
||||
<!REDECLARATION!>object Named<!>
|
||||
}
|
||||
|
||||
class C {
|
||||
<!REDECLARATION!>class Named<!>
|
||||
|
||||
companion <!REDECLARATION!>object Named<!>
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -DUPLICATE_CLASS_NAMES
|
||||
package test
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
data class A1(<!REDECLARATION!>val x: Int<!>, val y: String, <!REDECLARATION!>val x: Int<!>) {
|
||||
data class A1(val <!REDECLARATION!>x<!>: Int, val y: String, val <!REDECLARATION!>x<!>: Int) {
|
||||
val z = ""
|
||||
}
|
||||
|
||||
data class A2(<!REDECLARATION!>val x: Int<!>, val y: String) {
|
||||
<!REDECLARATION!>val x = ""<!>
|
||||
data class A2(val <!REDECLARATION!>x<!>: Int, val y: String) {
|
||||
val <!REDECLARATION!>x<!> = ""
|
||||
}
|
||||
|
||||
data class A3(<!REDECLARATION!>val<!SYNTAX!><!> :Int<!>, <!REDECLARATION!>val<!SYNTAX!><!> : Int<!>)
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
class C {
|
||||
companion <!REDECLARATION!>object<!> {}
|
||||
|
||||
<!REDECLARATION!>val Companion = C<!>
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class C {
|
||||
companion <!REDECLARATION!>object<!> {}
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
class B {
|
||||
companion <!REDECLARATION!>object A<!> {
|
||||
companion object <!REDECLARATION!>A<!> {
|
||||
}
|
||||
|
||||
<!REDECLARATION!>val A = this<!>
|
||||
val <!REDECLARATION!>A<!> = this
|
||||
}
|
||||
|
||||
class C {
|
||||
|
||||
+1
-1
@@ -45,4 +45,4 @@ actual annotation class Foo5
|
||||
|
||||
actual annotation class Foo6(val s: String = "value")
|
||||
|
||||
<!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>actual typealias Foo7 = Bar2<!>
|
||||
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo7<!> = Bar2
|
||||
|
||||
+3
-3
@@ -34,9 +34,9 @@ actual class Foo1(val s: String)
|
||||
actual class Foo2(val p: String = "value", i: Int)
|
||||
actual typealias Foo3 = JavaFoo
|
||||
|
||||
<!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>actual class Bar1(val s: String)<!>
|
||||
<!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>actual class Bar2(val p: String = "value", i: Int)<!>
|
||||
<!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>actual typealias Bar3 = JavaBar<!>
|
||||
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar1<!>(val s: String)
|
||||
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar2<!>(val p: String = "value", i: Int)
|
||||
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar3<!> = JavaBar
|
||||
actual class Bar4(val s: String) {
|
||||
constructor() : this("")
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,6 +23,6 @@ interface Foo1
|
||||
|
||||
fun foo2(): Int = 0
|
||||
|
||||
<!ACTUAL_WITHOUT_EXPECT, REDECLARATION!>actual class Foo3<!>
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>Foo3<!><!>
|
||||
|
||||
<!REDECLARATION!>class Foo3<!>
|
||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>Foo3<!>
|
||||
|
||||
Vendored
+1
-1
@@ -39,7 +39,7 @@ actual class C {
|
||||
actual inner class I
|
||||
}
|
||||
|
||||
<!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>actual class D<!>
|
||||
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>D<!>
|
||||
|
||||
actual class E {
|
||||
class N
|
||||
|
||||
@@ -18,7 +18,7 @@ expect class Foo {
|
||||
|
||||
// TODO: do not suppress UNSUPPORTED once JS files in multi-platform tests are analyzed with JS analyzer facade
|
||||
|
||||
<!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>actual class Foo {
|
||||
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> {
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual constructor(p: dynamic) {}<!>
|
||||
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual fun f1(s: dynamic): dynamic = null!!<!>
|
||||
@@ -26,4 +26,4 @@ expect class Foo {
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual fun f2(s: dynamic): MutableMap<Boolean?, Foo> = null!!<!>
|
||||
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual fun <T : Set<Number>> f3(t: T): dynamic = null!!<!>
|
||||
}<!>
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -20,7 +20,7 @@ expect inline class NonInlineActual(val x: Int)
|
||||
actual inline class Foo1(val x: Int) {
|
||||
actual fun bar(): String = "Hello"
|
||||
}
|
||||
<!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>actual inline class Foo2(val x: String)<!>
|
||||
actual inline class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo2<!>(val x: String)
|
||||
actual <!ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS!>inline<!> class Foo3
|
||||
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual inline class NonInlineExpect(val x: Int)<!>
|
||||
|
||||
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
class Aaa() {
|
||||
<!REDECLARATION!>val a = 1<!>
|
||||
<!REDECLARATION!>val a = 1<!>
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class Aaa() {
|
||||
val <!REDECLARATION!>a<!> = 1
|
||||
val <!REDECLARATION!>a<!> = 1
|
||||
|
||||
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
class Aaa() {
|
||||
<!REDECLARATION!>val a = 1<!>
|
||||
<!REDECLARATION!>val a = ""<!>
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class Aaa() {
|
||||
val <!REDECLARATION!>a<!> = 1
|
||||
val <!REDECLARATION!>a<!> = ""
|
||||
|
||||
Vendored
-12
@@ -1,12 +0,0 @@
|
||||
// FIR_IDE_IGNORE
|
||||
// FILE: f1.kt
|
||||
package test
|
||||
|
||||
<!REDECLARATION!>class A<!>
|
||||
class F1
|
||||
|
||||
// FILE: f2.kt
|
||||
package test
|
||||
|
||||
<!REDECLARATION!>class A<!>
|
||||
class F2
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// FIR_IDE_IGNORE
|
||||
// FILE: f1.kt
|
||||
package test
|
||||
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
package foo
|
||||
|
||||
<!REDECLARATION!>val Int.foo: Int get() = 2<!>
|
||||
<!REDECLARATION!>val Int.foo: Int get() = 3<!>
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
package foo
|
||||
|
||||
val Int.<!REDECLARATION!>foo<!>: Int get() = 2
|
||||
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
public class A() {
|
||||
<!REDECLARATION!>public val FOO: String = "test"<!>
|
||||
|
||||
<!REDECLARATION!>public class FOO() { }<!>
|
||||
}
|
||||
|
||||
public class B() {
|
||||
companion object {
|
||||
<!REDECLARATION!>public val FOO: String = "test"<!>
|
||||
|
||||
<!REDECLARATION!>public class FOO() { }<!>
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
public class A() {
|
||||
public val <!REDECLARATION!>FOO<!>: String = "test"
|
||||
|
||||
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
class A {
|
||||
companion object B {
|
||||
<!REDECLARATION!>class G<!>
|
||||
<!REDECLARATION!>val G = 1<!>
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class A {
|
||||
companion object B {
|
||||
class <!REDECLARATION!>G<!>
|
||||
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
// FILE: a.kt
|
||||
<!REDECLARATION!>val a : Int = 1<!>
|
||||
<!CONFLICTING_OVERLOADS!>fun f()<!> {
|
||||
}
|
||||
|
||||
// FILE: b.kt
|
||||
<!REDECLARATION!>val a : Int = 1<!>
|
||||
<!CONFLICTING_OVERLOADS!>fun f()<!> {
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// FILE: a.kt
|
||||
val <!REDECLARATION!>a<!> : Int = 1
|
||||
<!CONFLICTING_OVERLOADS!>fun f()<!> {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// FILE: a.kt
|
||||
package redeclarations
|
||||
<!REDECLARATION!>object A<!> {
|
||||
object <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>A<!> {
|
||||
val x : Int = 0
|
||||
|
||||
val A = 1
|
||||
}
|
||||
|
||||
<!REDECLARATION!>class A {}<!>
|
||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>A<!> {}
|
||||
|
||||
<!REDECLARATION!>val A = 1<!>
|
||||
val <!REDECLARATION!>A<!> = 1
|
||||
|
||||
// FILE: b.kt
|
||||
package redeclarations.A
|
||||
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
// !DIAGNOSTICS: -DUPLICATE_CLASS_NAMES
|
||||
// KT-3525
|
||||
object B {
|
||||
<!REDECLARATION!>class C<!>
|
||||
<!REDECLARATION!>class C<!>
|
||||
|
||||
<!REDECLARATION!>val a : Int = 1<!>
|
||||
<!REDECLARATION!>val a : Int = 1<!>
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -DUPLICATE_CLASS_NAMES
|
||||
// KT-3525
|
||||
object B {
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ private fun validFun() {}
|
||||
private val validVal = 1
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>private fun invalidFun0()<!> {}
|
||||
<!REDECLARATION!>private val invalidProp0 = 1<!>
|
||||
private val <!REDECLARATION!>invalidProp0<!> = 1
|
||||
|
||||
// NB invalidFun0 and invalidProp0 are conflicting overloads, since the following is an ambiguity:
|
||||
fun useInvalidFun0() = invalidFun0()
|
||||
@@ -36,7 +36,7 @@ private val validVal = 1
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>private fun invalidFun0()<!> {}
|
||||
|
||||
<!REDECLARATION!>private val invalidProp0 = 1<!>
|
||||
private val <!REDECLARATION!>invalidProp0<!> = 1
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>internal fun invalidFun3()<!> {}
|
||||
<!CONFLICTING_OVERLOADS!>internal fun invalidFun4()<!> {}
|
||||
|
||||
+10
-10
@@ -1,13 +1,13 @@
|
||||
<!REDECLARATION!>val Test1 = null<!>
|
||||
<!REDECLARATION!>class Test1<!>
|
||||
val <!REDECLARATION!>Test1<!> = null
|
||||
class <!REDECLARATION!>Test1<!>
|
||||
|
||||
<!REDECLARATION!>val Test2 = null<!>
|
||||
<!REDECLARATION!>interface Test2<!>
|
||||
val <!REDECLARATION!>Test2<!> = null
|
||||
interface <!REDECLARATION!>Test2<!>
|
||||
|
||||
<!REDECLARATION!>val Test3 = null<!>
|
||||
<!REDECLARATION!>object Test3<!>
|
||||
val <!REDECLARATION!>Test3<!> = null
|
||||
object <!REDECLARATION!>Test3<!>
|
||||
|
||||
<!REDECLARATION!>val Test4 = null<!>
|
||||
<!REDECLARATION!>class Test4<!>
|
||||
<!REDECLARATION!>interface Test4<!>
|
||||
<!REDECLARATION!>object Test4<!>
|
||||
val <!REDECLARATION!>Test4<!> = null
|
||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>Test4<!>
|
||||
interface <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>Test4<!>
|
||||
object <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>Test4<!>
|
||||
@@ -1,18 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -TOPLEVEL_TYPEALIASES_ONLY
|
||||
// FILE: file1.kt
|
||||
<!REDECLARATION!>class SomeClass<!>
|
||||
|
||||
<!REDECLARATION!>typealias SomeClass = Any<!>
|
||||
<!REDECLARATION!>typealias SomeClass = Any<!>
|
||||
<!REDECLARATION!>typealias SomeClass = Any<!>
|
||||
|
||||
class Outer {
|
||||
<!REDECLARATION!>class Nested<!>
|
||||
|
||||
<!REDECLARATION!>typealias Nested = Any<!>
|
||||
<!REDECLARATION!>typealias Nested = Any<!>
|
||||
<!REDECLARATION!>typealias Nested = Any<!>
|
||||
}
|
||||
|
||||
// FILE: file2.kt
|
||||
<!REDECLARATION!>typealias SomeClass = Any<!>
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -TOPLEVEL_TYPEALIASES_ONLY
|
||||
// FILE: file1.kt
|
||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>SomeClass<!>
|
||||
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -TOPLEVEL_TYPEALIASES_ONLY
|
||||
// FILE: file1.kt
|
||||
<!REDECLARATION!>typealias Test = String<!>
|
||||
typealias <!REDECLARATION!>Test<!> = String
|
||||
|
||||
<!REDECLARATION!>val Test = 42<!>
|
||||
val <!REDECLARATION!>Test<!> = 42
|
||||
|
||||
class Outer {
|
||||
<!REDECLARATION!>typealias Test = String<!>
|
||||
typealias <!REDECLARATION!>Test<!> = String
|
||||
|
||||
<!REDECLARATION!>val Test = 42<!>
|
||||
val <!REDECLARATION!>Test<!> = 42
|
||||
}
|
||||
|
||||
typealias Test2 = String
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
// !DIAGNOSTICS: -DUPLICATE_CLASS_NAMES
|
||||
//KT-2438 Prohibit inner classes with the same name
|
||||
|
||||
package kt2438
|
||||
|
||||
class B {
|
||||
<!REDECLARATION!>class C<!>
|
||||
<!REDECLARATION!>class C<!>
|
||||
}
|
||||
|
||||
|
||||
|
||||
class A {
|
||||
<!REDECLARATION!>class B<!>
|
||||
|
||||
companion object {
|
||||
<!REDECLARATION!>class B<!>
|
||||
<!REDECLARATION!>class B<!>
|
||||
}
|
||||
|
||||
<!REDECLARATION!>class B<!>
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -DUPLICATE_CLASS_NAMES
|
||||
//KT-2438 Prohibit inner classes with the same name
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
<!REDECLARATION!>val a : Int = 1<!>
|
||||
<!REDECLARATION!>val a : Int = 1<!>
|
||||
<!REDECLARATION!>val a : Int = 1<!>
|
||||
|
||||
<!REDECLARATION!>val b : Int = 1<!>
|
||||
<!REDECLARATION!>val b : Int = 1<!>
|
||||
<!REDECLARATION!>val b : Int = 1<!>
|
||||
<!REDECLARATION!>val b : Int = 1<!>
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun foo()<!> {} // and here too
|
||||
<!CONFLICTING_OVERLOADS!>fun foo()<!> {} // and here
|
||||
<!CONFLICTING_OVERLOADS!>fun foo()<!> {} // and here
|
||||
<!CONFLICTING_OVERLOADS!>fun foo()<!> {} // and here
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun bar()<!> {} // and here
|
||||
<!CONFLICTING_OVERLOADS!>fun bar()<!> {} // and here
|
||||
<!CONFLICTING_OVERLOADS!>fun bar()<!> {} // and here
|
||||
|
||||
class A {
|
||||
<!REDECLARATION!>val a : Int = 1<!>
|
||||
<!REDECLARATION!>val a : Int = 1<!>
|
||||
<!REDECLARATION!>val a : Int = 1<!>
|
||||
|
||||
<!REDECLARATION!>val b : Int = 1<!>
|
||||
<!REDECLARATION!>val b : Int = 1<!>
|
||||
<!REDECLARATION!>val b : Int = 1<!>
|
||||
<!REDECLARATION!>val b : Int = 1<!>
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun foo()<!> {} // and here too
|
||||
<!CONFLICTING_OVERLOADS!>fun foo()<!> {} // and here
|
||||
<!CONFLICTING_OVERLOADS!>fun foo()<!> {} // and here
|
||||
<!CONFLICTING_OVERLOADS!>fun foo()<!> {} // and here
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun bar()<!> {} // and here
|
||||
<!CONFLICTING_OVERLOADS!>fun bar()<!> {} // and here
|
||||
<!CONFLICTING_OVERLOADS!>fun bar()<!> {} // and here
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
val <!REDECLARATION!>a<!> : Int = 1
|
||||
val <!REDECLARATION!>a<!> : Int = 1
|
||||
val <!REDECLARATION!>a<!> : Int = 1
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// JET-11 Redeclaration & Forward reference for classes cause an exception
|
||||
<!REDECLARATION!>open class NoC<!>
|
||||
class NoC1 : NoC()
|
||||
<!REDECLARATION!>open class NoC<!>
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// JET-11 Redeclaration & Forward reference for classes cause an exception
|
||||
open class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>NoC<!>
|
||||
class NoC1 : NoC()
|
||||
|
||||
compiler/testData/diagnostics/tests/secondaryConstructors/redeclarationsOfConstructorsIgnored.fir.kt
Vendored
-11
@@ -1,11 +0,0 @@
|
||||
<!REDECLARATION!>class A<!>
|
||||
<!REDECLARATION!>class A {
|
||||
constructor()
|
||||
}<!>
|
||||
|
||||
class B
|
||||
class Outer {
|
||||
class B {
|
||||
constructor()
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>A<!>
|
||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>A<!> {
|
||||
constructor()
|
||||
|
||||
@@ -19,5 +19,5 @@ private val test1co: C.Companion = <!INITIALIZER_TYPE_MISMATCH, NO_COMPANION_OBJ
|
||||
private val test2: TA = <!INITIALIZER_TYPE_MISMATCH!>TA(<!NO_VALUE_FOR_PARAMETER!>)<!><!>
|
||||
private val test2co = TA
|
||||
|
||||
<!REDECLARATION!>private class C<!>
|
||||
<!REDECLARATION!>private typealias TA = Int<!>
|
||||
private class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>C<!>
|
||||
private typealias <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>TA<!> = Int
|
||||
|
||||
Reference in New Issue
Block a user