5909b191a5
- `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.
156 lines
4.1 KiB
Plaintext
Vendored
156 lines
4.1 KiB
Plaintext
Vendored
FILE: RedundantModalityModifierChecker.kt
|
|
public final object O : R|kotlin/Any| {
|
|
private constructor(): R|O| {
|
|
super<R|kotlin/Any|>()
|
|
}
|
|
|
|
public final fun foo(): R|kotlin/Unit| {
|
|
}
|
|
|
|
}
|
|
public abstract interface Interface : R|kotlin/Any| {
|
|
public open val gav: R|kotlin/Int|
|
|
public get(): R|kotlin/Int| {
|
|
^ Int(42)
|
|
}
|
|
|
|
public abstract fun foo(): R|kotlin/Unit|
|
|
|
|
private final fun bar(): R|kotlin/Unit|
|
|
|
|
public abstract fun loo(): R|kotlin/Unit|
|
|
|
|
public open fun goo(): R|kotlin/Unit| {
|
|
}
|
|
|
|
public abstract fun tar(): R|kotlin/Unit|
|
|
|
|
public abstract fun too(): R|kotlin/Unit| {
|
|
}
|
|
|
|
}
|
|
public abstract interface B : R|kotlin/Any| {
|
|
public abstract var bar: R|kotlin/Unit|
|
|
public get(): R|kotlin/Unit|
|
|
public set(value: R|kotlin/Unit|): R|kotlin/Unit|
|
|
|
|
public abstract fun foo(): R|kotlin/Unit|
|
|
|
|
}
|
|
public abstract interface Foo : R|kotlin/Any| {
|
|
}
|
|
public abstract expect class AbstractClass : R|Foo| {
|
|
public abstract expect override fun foo(): R|kotlin/Unit|
|
|
|
|
public abstract expect fun bar(): R|kotlin/Unit|
|
|
|
|
public abstract expect val baz: R|kotlin/Int|
|
|
public get(): R|kotlin/Int|
|
|
|
|
}
|
|
public abstract class Base : R|kotlin/Any| {
|
|
public constructor(): R|Base| {
|
|
super<R|kotlin/Any|>()
|
|
}
|
|
|
|
public final fun foo(): R|kotlin/Unit| {
|
|
}
|
|
|
|
public abstract fun bar(): R|kotlin/Unit|
|
|
|
|
public open val gav: R|kotlin/Int| = Int(42)
|
|
public get(): R|kotlin/Int|
|
|
|
|
}
|
|
public final class FinalDerived : R|Base| {
|
|
public constructor(): R|FinalDerived| {
|
|
super<R|Base|>()
|
|
}
|
|
|
|
public final override fun bar(): R|kotlin/Unit| {
|
|
}
|
|
|
|
public open override val gav: R|kotlin/Int| = Int(13)
|
|
public get(): R|kotlin/Int|
|
|
|
|
}
|
|
public open class OpenDerived : R|Base| {
|
|
public constructor(): R|OpenDerived| {
|
|
super<R|Base|>()
|
|
}
|
|
|
|
public final override fun bar(): R|kotlin/Unit| {
|
|
}
|
|
|
|
public open override val gav: R|kotlin/Int| = Int(13)
|
|
public get(): R|kotlin/Int|
|
|
|
|
private final fun fan(): R|kotlin/Unit| {
|
|
}
|
|
|
|
}
|
|
public final class Final : R|kotlin/Any| {
|
|
public constructor(): R|Final| {
|
|
super<R|kotlin/Any|>()
|
|
}
|
|
|
|
}
|
|
public abstract interface Derived : R|Interface| {
|
|
public open override fun foo(): R|kotlin/Unit| {
|
|
}
|
|
|
|
public final class Nested : R|kotlin/Any| {
|
|
public constructor(): R|Derived.Nested| {
|
|
super<R|kotlin/Any|>()
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
public abstract class AbstractDerived1 : R|Interface| {
|
|
public constructor(gav: R|kotlin/Int|): R|AbstractDerived1| {
|
|
super<R|kotlin/Any|>()
|
|
}
|
|
|
|
public final override val gav: R|kotlin/Int| = R|<local>/gav|
|
|
public get(): R|kotlin/Int|
|
|
|
|
public open override fun foo(): R|kotlin/Unit| {
|
|
}
|
|
|
|
}
|
|
public abstract class AbstractDerived2 : R|Interface| {
|
|
public constructor(): R|AbstractDerived2| {
|
|
super<R|kotlin/Any|>()
|
|
}
|
|
|
|
public final override fun foo(): R|kotlin/Unit| {
|
|
}
|
|
|
|
public open override val gav: R|kotlin/Int| = Int(13)
|
|
public get(): R|kotlin/Int|
|
|
|
|
}
|
|
public abstract interface AbstractInterface : R|kotlin/Any| {
|
|
}
|
|
public final object FinalObject : R|kotlin/Any| {
|
|
private constructor(): R|FinalObject| {
|
|
super<R|kotlin/Any|>()
|
|
}
|
|
|
|
}
|
|
public open interface OpenInterface : R|kotlin/Any| {
|
|
}
|
|
public final class FinalDerived2 : R|Base| {
|
|
public constructor(gav: R|kotlin/Int|): R|FinalDerived2| {
|
|
super<R|Base|>()
|
|
}
|
|
|
|
public final override val gav: R|kotlin/Int| = R|<local>/gav|
|
|
public get(): R|kotlin/Int|
|
|
|
|
public open override fun bar(): R|kotlin/Unit| {
|
|
}
|
|
|
|
}
|