[tests] Refactor code examples relevant to exploration of KT-22004

This commit is contained in:
Stanislav Ruban
2023-11-14 06:50:23 +02:00
committed by Space Team
parent d0958068c9
commit c7caca8ccd
19 changed files with 0 additions and 132 deletions
@@ -0,0 +1,5 @@
class Aaa() {
val a = 1
@Deprecated("a", level = DeprecationLevel.HIDDEN)
val a = 1
}
@@ -0,0 +1,5 @@
class Aaa() {
val <!REDECLARATION!>a<!> = 1
@Deprecated("a", level = DeprecationLevel.HIDDEN)
val <!REDECLARATION!>a<!> = 1
}
@@ -0,0 +1,5 @@
class Aaa() {
val a = 1
@Deprecated("a", level = DeprecationLevel.HIDDEN)
val a = ""
}
@@ -0,0 +1,5 @@
class Aaa() {
val <!REDECLARATION!>a<!> = 1
@Deprecated("a", level = DeprecationLevel.HIDDEN)
val <!REDECLARATION!>a<!> = ""
}
@@ -0,0 +1,57 @@
// constructor vs. fun overload
// FILE: J.java
package constructorVsFun;
public class J {
public J(String s) {}
}
// FILE: G.java
package constructorVsFun;
public class G {
@kotlin.Deprecated("G", level = DeprecationLevel.HIDDEN)
public G(String s) {}
}
// FILE: test.kt
package constructorVsFun
class a() { }
@Deprecated("a", level = DeprecationLevel.HIDDEN)
fun a() = 1
class b @Deprecated("b", level = DeprecationLevel.HIDDEN) constructor() { }
fun b() = 2
class Tram {
@Deprecated("f", level = DeprecationLevel.HIDDEN)
fun f() { }
class f() { }
}
class Yvayva {
companion object {
@Deprecated("fghj", level = DeprecationLevel.HIDDEN)
fun fghj() { }
class fghj() { }
}
}
class Rtyu {
fun ololo() { }
companion object {
class ololo() { }
}
}
@Deprecated("J", level = DeprecationLevel.HIDDEN)
fun J(s: String) { }
fun G(s: String) { }
@@ -0,0 +1,57 @@
// constructor vs. fun overload
// FILE: J.java
package constructorVsFun;
public class J {
public J(String s) {}
}
// FILE: G.java
package constructorVsFun;
public class G {
@kotlin.Deprecated("G", level = DeprecationLevel.HIDDEN)
public G(String s) {}
}
// FILE: test.kt
package constructorVsFun
class a<!CONFLICTING_OVERLOADS!>()<!> { }
<!CONFLICTING_OVERLOADS!>@Deprecated("a", level = DeprecationLevel.HIDDEN)
fun a()<!> = 1
class b @Deprecated("b", level = DeprecationLevel.HIDDEN) <!CONFLICTING_OVERLOADS!>constructor()<!> { }
<!CONFLICTING_OVERLOADS!>fun b()<!> = 2
class Tram {
<!CONFLICTING_OVERLOADS!>@Deprecated("f", level = DeprecationLevel.HIDDEN)
fun f()<!> { }
class f<!CONFLICTING_OVERLOADS!>()<!> { }
}
class Yvayva {
companion object {
<!CONFLICTING_OVERLOADS!>@Deprecated("fghj", level = DeprecationLevel.HIDDEN)
fun fghj()<!> { }
class fghj<!CONFLICTING_OVERLOADS!>()<!> { }
}
}
class Rtyu {
fun ololo() { }
companion object {
class ololo() { }
}
}
@Deprecated("J", level = DeprecationLevel.HIDDEN)
fun J(s: String) { }
fun G(s: String) { }
@@ -0,0 +1,265 @@
// FIR_IDENTICAL
fun test() {
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
fun test4(): String<!> = ""
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5(x: Int)<!> = x
fun local() {
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
fun test4(): String<!> = ""
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5(x: Int)<!> = x
}
}
class Test {
init {
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
fun test4(): String<!> = ""
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5(x: Int)<!> = x
}
fun test() {
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
fun test4(): String<!> = ""
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5(x: Int)<!> = x
}
val property: Any get() {
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
fun test4(): String<!> = ""
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5(x: Int)<!> = x
return 0
}
}
val property: Any get() {
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
fun test4(): String<!> = ""
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5(x: Int)<!> = x
return 0
}
object Object {
fun test() {
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
fun test4(): String<!> = ""
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5(x: Int)<!> = x
}
val property: Any get() {
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
fun test4(): String<!> = ""
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5(x: Int)<!> = x
return 0
}
}
val obj = object {
fun test() {
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
fun test4(): String<!> = ""
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5(x: Int)<!> = x
}
val property: Any get() {
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
fun test4(): String<!> = ""
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
fun Test5(x: Int)<!> = x
return 0
}
}
@@ -0,0 +1,17 @@
import java.io.Serializable
interface Test1 {
fun <T> foo(t: T) where T : Cloneable, T : Serializable
@Deprecated("foo", level = DeprecationLevel.HIDDEN)
fun <T> foo(t: T) where T : Serializable, T : Cloneable
}
interface I1
interface I2 : I1
interface Test2 {
fun <T> foo(t: T) where T : I1, T : I2
@Deprecated("foo", level = DeprecationLevel.HIDDEN)
fun <T> foo(t: T) where T : I2, T : I1
}
@@ -0,0 +1,17 @@
import java.io.Serializable
interface Test1 {
<!CONFLICTING_OVERLOADS!>fun <T> foo(t: T)<!> where T : Cloneable, T : Serializable
<!CONFLICTING_OVERLOADS!>@Deprecated("foo", level = DeprecationLevel.HIDDEN)
fun <T> foo(t: T)<!> where T : Serializable, T : Cloneable
}
interface I1
interface I2 : I1
interface Test2 {
<!CONFLICTING_OVERLOADS!>fun <T> foo(t: T)<!> where T : I1, T : I2
<!CONFLICTING_OVERLOADS!>@Deprecated("foo", level = DeprecationLevel.HIDDEN)
fun <T> foo(t: T)<!> where T : I2, T : I1
}