FIR: introduce delegated & overridden conflict checks

This commit is contained in:
Mikhail Glukhikh
2021-03-23 15:13:30 +03:00
parent 566dc434cc
commit 42d53dd954
22 changed files with 131 additions and 120 deletions
@@ -39,18 +39,18 @@ class CBarT<T> : IBarT<T> {
override val bar: T get() = null!!
}
class Test1 : Final(), IFoo by CFoo()
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test1<!> : Final(), IFoo by CFoo()
class Test2 : Final(), IBar by CBar()
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test2<!> : Final(), IBar by CBar()
class Test3 : Final(), IQux by CQux()
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test3<!> : Final(), IQux by CQux()
class Test4 : Derived(), IFoo by CFoo()
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test4<!> : Derived(), IFoo by CFoo()
class Test5 : Derived(), IBar by CBar()
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test5<!> : Derived(), IBar by CBar()
class Test6 : Derived(), IQux by CQux()
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test6<!> : Derived(), IQux by CQux()
class Test7 : Final(), IBarT<Int> by CBarT<Int>()
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test7<!> : Final(), IBarT<Int> by CBarT<Int>()
class Test8 : Final(), IBarT<Int> by CBar()
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test8<!> : Final(), IBarT<Int> by CBar()
@@ -6,7 +6,7 @@ open class IDerived1 : IBase1 {
override fun foo(): String = "1"
}
class Broken1(val b: IBase1) : IBase1 by b, IDerived1()
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>class Broken1<!>(val b: IBase1) : IBase1 by b, IDerived1()
interface IBase2 {
val foo: Any
@@ -16,4 +16,4 @@ open class IDerived2 : IBase2 {
override val foo: String = "2"
}
class Broken2(val b: IBase2) : IBase2 by b, IDerived2()
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>class Broken2<!>(val b: IBase2) : IBase2 by b, IDerived2()
@@ -1,19 +0,0 @@
public interface Base {
fun test() = "OK"
}
public interface Base2 : Base {
override fun test() = "OK2"
}
class Delegate : Base2
fun box(): String {
object : Base, Base2 by Delegate() {
}
object : Base2, Base by Delegate() {
}
return "OK"
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
public interface Base {
fun test() = "OK"
}
@@ -1,26 +0,0 @@
public interface Base {
var test: String
get() = "OK"
set(s: String) {
}
}
public interface Base2 : Base {
override var test: String
get() = "OK2"
set(value) {}
}
class Delegate : Base2 {
}
fun box(): String {
object : Base, Base2 by Delegate() {
}
object : Base2, Base by Delegate() {
}
return "OK"
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
public interface Base {
var test: String
get() = "OK"
@@ -23,19 +23,19 @@ class ImplAll : Base, Base2, Base3 {
}
fun box(): String {
object : Base2, Base3, Base by Impl() {
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : Base2, Base3, Base by Impl() {
}
object : Base2 by Impl2(), Base3, Base {
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : Base2 by Impl2(), Base3, Base {
}
object : Base2, Base3 by Impl3(), Base {
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : Base2, Base3 by Impl3(), Base {
}
object : Base2 by Impl2(), Base3 by Impl3(), Base by Impl() {
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>object<!> : Base2 by Impl2(), Base3 by Impl3(), Base by Impl() {
}
@@ -1,13 +0,0 @@
interface Base {
fun test() = "Base"
}
class Delegate : Base
abstract class Middle : Base {
override fun test() = "MyClass"
}
abstract class MyClass : Middle()
class A : MyClass(), Base by Delegate()
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface Base {
fun test() = "Base"
}
@@ -14,7 +14,7 @@ class Delegate : Derived {
public open class MyClass : Base by Delegate()
fun box(): String {
object : MyClass(), Derived by Delegate() {
<!MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>object<!> : MyClass(), Derived by Delegate() {
}
return "OK"
}
@@ -23,6 +23,6 @@ public abstract class MyClass : Base1, Base2 {
}
}
class A : MyClass(), Base1 by Delegate1(), Base1 by Delegate2() {
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>class A<!> : MyClass(), Base1 by Delegate1(), Base1 by Delegate2() {
}
@@ -1,19 +0,0 @@
public interface Base {
fun getValue(): String
fun test() = getValue()
}
class Delegate : Base {
override fun getValue() = "Delegate"
}
public abstract class MyClass : Base {
override fun test(): String {
return "Class"
}
}
class A : MyClass(), Base by Delegate() {
override fun getValue() = "Delegate"
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
public interface Base {
fun getValue(): String
@@ -1,17 +0,0 @@
public interface Base {
val test: String
get() = "OK"
}
open class Delegate : Base {
override val test: String
get() = "OK"
}
fun box(): String {
object : Delegate(), Base by Delegate() {
}
return "OK"
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
public interface Base {
val test: String
get() = "OK"