[FIR] KT-54507 Report REDUNDANT_MODALITY_MODIFIER for open interface
- `REDUNDANT_MODIFIER_FOR_TARGET` is already reported for `open` interfaces, but for consistency and IDE support, the compiler now reports `REDUNDANT_MODALITY_MODIFIER` as well via the extended checker. - `REDUNDANT_MODIFIER_FOR_TARGET` cannot be disabled for this case because it's reported via a basic checker while `REDUNDANT_MODALITY_MODIFIER` is reported via an extended checker. - Rename `implicitModality` to `redundantModalities` and return a set of modalities. The idea of a *single* implicit/redundant modality doesn't stand up to scrutiny. For example, for interfaces with `ABSTRACT` implicit modality, `OPEN` is also a redundant modifier. But this is not necessarily the case for all kinds of declarations. Hypothetically, if it was possible to declare a class that is abstract by default, adding an `open` modifier to that class would not be redundant, as it would make the class instantiable.
This commit is contained in:
committed by
Space Team
parent
76ca96d2e2
commit
5909b191a5
Vendored
+2
-1
@@ -12,6 +12,7 @@ interface Interface {
|
||||
// error
|
||||
<!PRIVATE_FUNCTION_WITH_NO_BODY!>private<!> <!WRONG_MODIFIER_CONTAINING_DECLARATION!>final<!> fun bar()
|
||||
|
||||
<!REDUNDANT_MODALITY_MODIFIER, REDUNDANT_OPEN_IN_INTERFACE!>open<!> fun loo()
|
||||
<!REDUNDANT_MODALITY_MODIFIER!>open<!> fun goo() {}
|
||||
<!REDUNDANT_MODALITY_MODIFIER!>abstract<!> fun tar()
|
||||
|
||||
@@ -84,7 +85,7 @@ abstract class AbstractDerived2 : Interface {
|
||||
// Redundant final object
|
||||
<!REDUNDANT_MODALITY_MODIFIER!>final<!> object FinalObject
|
||||
// Open interface
|
||||
<!REDUNDANT_MODIFIER_FOR_TARGET!>open<!> interface OpenInterface
|
||||
<!REDUNDANT_MODALITY_MODIFIER, REDUNDANT_MODIFIER_FOR_TARGET!>open<!> interface OpenInterface
|
||||
|
||||
class FinalDerived2(override <!REDUNDANT_MODALITY_MODIFIER!>final<!> val gav: Int) : Base() {
|
||||
override fun bar() {}
|
||||
|
||||
Reference in New Issue
Block a user