FIR: report ABSTRACT_*_NOT_IMPLEMENTED on appropriate intersections

This commit is contained in:
Mikhail Glukhikh
2021-04-06 00:07:18 +03:00
parent 0fa2821ac1
commit 818c54e3a6
26 changed files with 30 additions and 107 deletions
@@ -1,9 +0,0 @@
package extendFunctionClass
class A : Function1<Int, Int> {
}
class B : Function1<Int, Int> {
override fun invoke(p1 : Int) = p1
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package extendFunctionClass
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class A<!> : Function1<Int, Int> {
@@ -1,14 +0,0 @@
interface A {
fun foo() {}
}
interface B : A {
abstract override fun foo()
}
interface C {
abstract fun foo()
}
// Fake override Z#foo should be abstract
class Z : B, C
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface A {
fun foo() {}
}
@@ -1,16 +0,0 @@
interface A {
fun foo() {}
}
interface B : A {
abstract override fun foo()
}
interface C : A {
abstract override fun foo()
}
interface D : A
// Fake override Z#foo should be abstract
class Z : B, C, D
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface A {
fun foo() {}
}
@@ -40,15 +40,15 @@ abstract class MyAbstractClass1 : MyTrait<Int>, MyAbstractClass<String>() {
override fun bar(t: String) = t
}
class MyIllegalGenericClass1<T> : MyTrait<T>, MyAbstractClass<T>() {}
class MyIllegalGenericClass2<T, R>(r : R) : MyTrait<T>, MyAbstractClass<R>() {
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class MyIllegalGenericClass1<!><T> : MyTrait<T>, MyAbstractClass<T>() {}
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class MyIllegalGenericClass2<!><T, R>(r : R) : MyTrait<T>, MyAbstractClass<R>() {
override fun foo(r: R) = r
override val <T> pr : R = r
}
class MyIllegalClass1 : MyTrait<Int>, MyAbstractClass<String>() {}
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class MyIllegalClass1<!> : MyTrait<Int>, MyAbstractClass<String>() {}
abstract class MyLegalAbstractClass1 : MyTrait<Int>, MyAbstractClass<String>() {}
class MyIllegalClass2<T>(t : T) : MyTrait<Int>, MyAbstractClass<Int>() {
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class MyIllegalClass2<!><T>(t : T) : MyTrait<Int>, MyAbstractClass<Int>() {
fun foo(t: T) = t
fun bar(t: T) = t
val <R> pr : T = t
@@ -6,5 +6,5 @@ interface Y {
fun foo(a : Int = 1)
}
class Z1 : X, Y {} // BUG
object Z1O : X, Y {} // BUG
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class Z1<!> : X, Y {} // BUG
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>object Z1O<!> : X, Y {} // BUG
@@ -1,17 +0,0 @@
package test
interface A {
val a: String
}
interface B {
val a: String
}
open class C {
private val a: String = ""
}
class Subject : C(), A, B {
val c = a
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package test
interface A {
@@ -1,11 +0,0 @@
// http://youtrack.jetbrains.com/issue/KT-1996
interface Foo {
fun foo(): Unit
}
interface Bar {
fun foo(): Unit
}
class Baz : Foo, Bar
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// http://youtrack.jetbrains.com/issue/KT-1996
interface Foo {
@@ -19,7 +19,7 @@ interface IDerived : ILeft, IRight {
}
// Error: ILeft::copy and IRight::copy have unrelated return types
class CDerivedInvalid1 : ILeft, IRight
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class CDerivedInvalid1<!> : ILeft, IRight
// Error: CLeft::copy and IRight::copy have unrelated return types
class CDerivedInvalid2 : CLeft(), IRight