Files
kotlin-fork/compiler/testData/diagnostics/tests/modifiers/OpenInterface.kt
T
Stanislav Ruban 2de0e4b8d2 [FIR][checkers] Respect ClassKind.INTERFACE in FirRegularClass.canHaveAbstractDeclaration
A Kotlin interface can have abstract members regardless of its modality. However, this invariant was previously ignored by FIR checkers. As a result, false-positive `ABSTRACT_<MEMBER>_IN_NON_ABSTRACT_CLASS` errors were being reported in explicitly non-abstract interfaces.

This commit makes a relevant FIR utility used by relevant FIR checkers aware of the aforementioned invariant.

#KT-66260 Fixed
2024-03-04 12:00:18 +00:00

17 lines
595 B
Kotlin
Vendored

// FIR_IDENTICAL
// FIR_DUMP
<!REDUNDANT_MODIFIER_FOR_TARGET!>open<!> interface OpenInterface {
fun defaultModalityFuncWithoutBody()
fun defaultModalityFuncWithBody() {}
abstract fun abstractFunc()
open fun openFunc() {}
val defaultModalityValWithoutGetter: Any
val defaultModalityValWithGetter: Any get() = 42
abstract val abstractVal: Any
open val openVal: Any get() = 42
abstract val abstractValWithGetter: Any <!ABSTRACT_PROPERTY_WITH_GETTER!>get() = 42<!>
abstract var abstractValWithSetter: Any <!ABSTRACT_PROPERTY_WITH_SETTER!>set(value) {}<!>
}