FIR: report MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED also on interfaces
This commit is contained in:
committed by
TeamCityServer
parent
3fc2cc410c
commit
67d1c35f19
+3
-3
@@ -37,7 +37,7 @@ object FirNotImplementedOverrideChecker : FirClassChecker() {
|
|||||||
val sourceKind = source.kind
|
val sourceKind = source.kind
|
||||||
if (sourceKind is FirFakeSourceElementKind && sourceKind != FirFakeSourceElementKind.EnumInitializer) return
|
if (sourceKind is FirFakeSourceElementKind && sourceKind != FirFakeSourceElementKind.EnumInitializer) return
|
||||||
val modality = declaration.modality()
|
val modality = declaration.modality()
|
||||||
if (modality == Modality.ABSTRACT || modality == Modality.SEALED) return
|
val canHaveAbstractDeclarations = modality == Modality.ABSTRACT || modality == Modality.SEALED
|
||||||
if (declaration is FirRegularClass && declaration.isExpect) return
|
if (declaration is FirRegularClass && declaration.isExpect) return
|
||||||
val classKind = declaration.classKind
|
val classKind = declaration.classKind
|
||||||
if (classKind == ClassKind.ANNOTATION_CLASS || classKind == ClassKind.ENUM_CLASS) return
|
if (classKind == ClassKind.ANNOTATION_CLASS || classKind == ClassKind.ENUM_CLASS) return
|
||||||
@@ -67,7 +67,7 @@ object FirNotImplementedOverrideChecker : FirClassChecker() {
|
|||||||
classScope.processPropertiesByName(name, ::collectSymbol)
|
classScope.processPropertiesByName(name, ::collectSymbol)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notImplementedSymbols.isNotEmpty()) {
|
if (!canHaveAbstractDeclarations && notImplementedSymbols.isNotEmpty()) {
|
||||||
val notImplemented = notImplementedSymbols.first().unwrapFakeOverrides().fir
|
val notImplemented = notImplementedSymbols.first().unwrapFakeOverrides().fir
|
||||||
if (notImplemented.isFromInterfaceOrEnum(context)) {
|
if (notImplemented.isFromInterfaceOrEnum(context)) {
|
||||||
reporter.reportOn(source, ABSTRACT_MEMBER_NOT_IMPLEMENTED, declaration, notImplemented, context)
|
reporter.reportOn(source, ABSTRACT_MEMBER_NOT_IMPLEMENTED, declaration, notImplemented, context)
|
||||||
@@ -75,7 +75,7 @@ object FirNotImplementedOverrideChecker : FirClassChecker() {
|
|||||||
reporter.reportOn(source, ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED, declaration, notImplemented, context)
|
reporter.reportOn(source, ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED, declaration, notImplemented, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (invisibleSymbols.isNotEmpty()) {
|
if (!canHaveAbstractDeclarations && invisibleSymbols.isNotEmpty()) {
|
||||||
val invisible = invisibleSymbols.first().fir
|
val invisible = invisibleSymbols.first().fir
|
||||||
if (context.session.languageVersionSettings.supportsFeature(LanguageFeature.ProhibitInvisibleAbstractMethodsInSuperclasses)) {
|
if (context.session.languageVersionSettings.supportsFeature(LanguageFeature.ProhibitInvisibleAbstractMethodsInSuperclasses)) {
|
||||||
reporter.reportOn(source, INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER, declaration, invisible, context)
|
reporter.reportOn(source, INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER, declaration, invisible, context)
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ interface B {
|
|||||||
abstract var bar: Unit
|
abstract var bar: Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
interface C : A, B
|
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>interface C<!> : A, B
|
||||||
|
|
||||||
abstract class D(sealed var x: Int) {
|
abstract class D(sealed var x: Int) {
|
||||||
abstract var y: Unit
|
abstract var y: Unit
|
||||||
|
|||||||
+3
-3
@@ -34,7 +34,7 @@ abstract class Test1 : IStr by CStr(), IInt
|
|||||||
|
|
||||||
abstract class Test2 : IStr, IInt by CInt()
|
abstract class Test2 : IStr, IInt by CInt()
|
||||||
|
|
||||||
abstract class Test3 : IStr by CStr(), IInt by CInt()
|
abstract <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class Test3<!> : IStr by CStr(), IInt by CInt()
|
||||||
|
|
||||||
abstract class Test4 : IStr by CStr(), IGeneric<String>
|
abstract class Test4 : IStr by CStr(), IGeneric<String>
|
||||||
|
|
||||||
@@ -49,9 +49,9 @@ abstract class Test8 : IGeneric<String> by CGeneric<String>(), IInt
|
|||||||
// Can't test right now due to https://youtrack.jetbrains.com/issue/KT-10258
|
// Can't test right now due to https://youtrack.jetbrains.com/issue/KT-10258
|
||||||
// abstract class Test9 : IGeneric<String> by CGeneric<String>(), IGeneric<Int>
|
// abstract class Test9 : IGeneric<String> by CGeneric<String>(), IGeneric<Int>
|
||||||
|
|
||||||
abstract class Test10 : IInt by CInt(), IStr by CStr(), IAny by CAny()
|
abstract <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class Test10<!> : IInt by CInt(), IStr by CStr(), IAny by CAny()
|
||||||
|
|
||||||
abstract class Test11 : IInt, IStr by CStr(), IAny by CAny()
|
abstract <!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>class Test11<!> : IInt, IStr by CStr(), IAny by CAny()
|
||||||
|
|
||||||
abstract class Test12 : IInt, IStr, IAny by CAny()
|
abstract class Test12 : IInt, IStr, IAny by CAny()
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -36,7 +36,7 @@ abstract class Test1 : IStr by CStr(), IInt
|
|||||||
|
|
||||||
abstract class Test2 : IStr, IInt by CInt()
|
abstract class Test2 : IStr, IInt by CInt()
|
||||||
|
|
||||||
abstract class Test3 : IStr by CStr(), IInt by CInt()
|
abstract <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class Test3<!> : IStr by CStr(), IInt by CInt()
|
||||||
|
|
||||||
abstract class Test4 : IStr by CStr(), IGeneric<String>
|
abstract class Test4 : IStr by CStr(), IGeneric<String>
|
||||||
|
|
||||||
@@ -51,9 +51,9 @@ abstract class Test8 : IGeneric<String> by CGeneric<String>(), IInt
|
|||||||
// Can't test due to https://youtrack.jetbrains.com/issue/KT-10258
|
// Can't test due to https://youtrack.jetbrains.com/issue/KT-10258
|
||||||
// abstract class Test9 : IGeneric<String> by CGeneric<String>(), IGeneric<Int>
|
// abstract class Test9 : IGeneric<String> by CGeneric<String>(), IGeneric<Int>
|
||||||
|
|
||||||
abstract class Test10 : IInt by CInt(), IStr by CStr(), IAny by CAny()
|
abstract <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class Test10<!> : IInt by CInt(), IStr by CStr(), IAny by CAny()
|
||||||
|
|
||||||
abstract class Test11 : IInt, IStr by CStr(), IAny by CAny()
|
abstract <!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>class Test11<!> : IInt, IStr by CStr(), IAny by CAny()
|
||||||
|
|
||||||
abstract class Test12 : IInt, IStr, IAny by CAny()
|
abstract class Test12 : IInt, IStr, IAny by CAny()
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
interface ILeft {
|
|
||||||
fun foo() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IRight {
|
|
||||||
fun foo()
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IDerived : ILeft, IRight
|
|
||||||
|
|
||||||
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class CDerived<!> : ILeft, IRight
|
|
||||||
|
|
||||||
abstract class ADerived : ILeft, IRight
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
interface ILeft {
|
interface ILeft {
|
||||||
fun foo() {}
|
fun foo() {}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -10,9 +10,9 @@ interface B{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AB: A, B
|
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>interface AB<!>: A, B
|
||||||
|
|
||||||
interface BA: B, A
|
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>interface BA<!>: B, A
|
||||||
|
|
||||||
|
|
||||||
interface C : A, B {
|
interface C : A, B {
|
||||||
|
|||||||
Vendored
+2
-2
@@ -9,9 +9,9 @@ interface B{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AB: A, B
|
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>interface AB<!>: A, B
|
||||||
|
|
||||||
interface BA: B, A
|
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>interface BA<!>: B, A
|
||||||
|
|
||||||
class C : A, B {
|
class C : A, B {
|
||||||
override fun test() {
|
override fun test() {
|
||||||
|
|||||||
Vendored
+2
-2
@@ -9,8 +9,8 @@ interface A {
|
|||||||
interface B{
|
interface B{
|
||||||
fun test()
|
fun test()
|
||||||
}
|
}
|
||||||
interface AB : A, B
|
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>interface AB<!> : A, B
|
||||||
interface BA : B, A
|
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>interface BA<!> : B, A
|
||||||
|
|
||||||
class C : A, B {
|
class C : A, B {
|
||||||
override fun test() {
|
override fun test() {
|
||||||
|
|||||||
Reference in New Issue
Block a user