[FIR] Add diagnostic CONFLICTING_OVERLOADS & REDECLARATION

This commit is contained in:
Nick
2020-08-05 09:35:10 +03:00
parent 36984009e9
commit 4669e019d1
72 changed files with 681 additions and 247 deletions
@@ -0,0 +1,68 @@
<!CONFLICTING_OVERLOADS!>fun test(x: Int) {}<!>
<!CONFLICTING_OVERLOADS!>fun test(y: Int) {}<!>
fun test() {}
fun test(z: Int, c: Char) {}
<!REDECLARATION!>open class A {
open fun rest(s: String) {}
open val u = 20
}<!>
<!REDECLARATION!>class A {
}<!>
<!REDECLARATION!>class B : A {
<!CONFLICTING_OVERLOADS!>override fun rest(s: String) {}<!>
<!CONFLICTING_OVERLOADS!>fun rest(s: String) {}<!>
fun rest(l: Long) {}
override val u = 310
}<!>
<!REDECLARATION!>interface B<!>
<!REDECLARATION!>enum class B<!>
<!REDECLARATION!>val u = 10<!>
<!REDECLARATION!>val u = 20<!>
<!REDECLARATION!>typealias TA = A<!>
<!REDECLARATION!>typealias TA = B<!>
typealias BA = A
fun <T> kek(t: T) where T : (String) -> Any?, T : Char {}
fun <T> kek(t: T) where T : () -> Boolean, T : String {}
fun <T : Int> kek(t: T) {}
fun lol(a: Array<Int>) {}
fun lol(a: Array<Boolean>) {}
<!CONFLICTING_OVERLOADS!>fun <T> mem(t: T) where T : () -> Boolean, T : String {}<!>
<!CONFLICTING_OVERLOADS!>fun <T> mem(t: T) where T : String, T : () -> Boolean {}<!>
class M {
companion <!REDECLARATION!>object<!> {}
<!REDECLARATION!>val Companion = object : Any {}<!>
}
fun B.foo() {}
class L {
fun B.foo() {}
}
fun mest()
class mest
fun() {}
private fun() {}
@@ -0,0 +1,124 @@
FILE: conflictingOverloads.kt
public final fun test(x: R|kotlin/Int|): R|kotlin/Unit| {
}
public final fun test(y: R|kotlin/Int|): R|kotlin/Unit| {
}
public final fun test(): R|kotlin/Unit| {
}
public final fun test(z: R|kotlin/Int|, c: R|kotlin/Char|): R|kotlin/Unit| {
}
public open class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public open fun rest(s: R|kotlin/String|): R|kotlin/Unit| {
}
public open val u: R|kotlin/Int| = Int(20)
public get(): R|kotlin/Int|
}
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
}
public final class B : R|A| {
public constructor(): R|B| {
super<R|A|>()
}
public final override fun rest(s: R|kotlin/String|): R|kotlin/Unit| {
}
public final fun rest(s: R|kotlin/String|): R|kotlin/Unit| {
}
public final fun rest(l: R|kotlin/Long|): R|kotlin/Unit| {
}
public final override val u: R|kotlin/Int| = Int(310)
public get(): R|kotlin/Int|
}
public abstract interface B : R|kotlin/Any| {
}
public final enum class B : R|kotlin/Enum<B>| {
private constructor(): R|B| {
super<R|kotlin/Enum<B>|>()
}
public final static fun values(): R|kotlin/Array<B>| {
}
public final static fun valueOf(value: R|kotlin/String|): R|B| {
}
}
public final val u: R|kotlin/Int| = Int(10)
public get(): R|kotlin/Int|
public final val u: R|kotlin/Int| = Int(20)
public get(): R|kotlin/Int|
public final typealias TA = R|A|
public final typealias TA = R|B|
public final typealias BA = R|A|
public final fun <T : R|(kotlin/String) -> kotlin/Any?|, R|kotlin/Char|> kek(t: R|T|): R|kotlin/Unit| {
}
public final fun <T : R|() -> kotlin/Boolean|, R|kotlin/String|> kek(t: R|T|): R|kotlin/Unit| {
}
public final fun <T : R|kotlin/Int|> kek(t: R|T|): R|kotlin/Unit| {
}
public final fun lol(a: R|kotlin/Array<kotlin/Int>|): R|kotlin/Unit| {
}
public final fun lol(a: R|kotlin/Array<kotlin/Boolean>|): R|kotlin/Unit| {
}
public final fun <T : R|() -> kotlin/Boolean|, R|kotlin/String|> mem(t: R|T|): R|kotlin/Unit| {
}
public final fun <T : R|kotlin/String|, R|() -> kotlin/Boolean|> mem(t: R|T|): R|kotlin/Unit| {
}
public final class M : R|kotlin/Any| {
public constructor(): R|M| {
super<R|kotlin/Any|>()
}
public final companion object Companion : R|kotlin/Any| {
private constructor(): R|M.Companion| {
super<R|kotlin/Any|>()
}
}
public final val Companion: R|<anonymous>| = object : R|kotlin/Any| {
private constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
}
public get(): R|<anonymous>|
}
public final fun R|B|.foo(): R|kotlin/Unit| {
}
public final class L : R|kotlin/Any| {
public constructor(): R|L| {
super<R|kotlin/Any|>()
}
public final fun R|B|.foo(): R|kotlin/Unit| {
}
}
public final fun mest(): R|kotlin/Unit|
public final class mest : R|kotlin/Any| {
public constructor(): R|mest| {
super<R|kotlin/Any|>()
}
}
public final fun <no name provided>(): R|kotlin/Unit| {
}
private final fun <no name provided>(): R|kotlin/Unit| {
}
@@ -1,9 +1,9 @@
class A {
companion object {
companion <!REDECLARATION!>object<!> {
}
companion <!MANY_COMPANION_OBJECTS!>object<!> {
companion <!MANY_COMPANION_OBJECTS, REDECLARATION!>object<!> {
}
}