b7d8e879a6
In particular, this commit includes: * Attempt to abstract access to FirSourceElement via FirModifier * Add more visit functions to DeclarationCheckersDiagnosticComponent * Add messages+factories for 4 modifier-related errors and warnings * Introduce FirModifierChecker
40 lines
594 B
Kotlin
Vendored
40 lines
594 B
Kotlin
Vendored
//KT-151 Inherit visibility when overriding
|
|
package kt151
|
|
|
|
open class A {
|
|
protected open fun x() {}
|
|
}
|
|
|
|
class B : A() {
|
|
override fun x() {} // No visibility modifier required
|
|
}
|
|
|
|
fun test(b: B) {
|
|
b.x()
|
|
}
|
|
|
|
|
|
//more tests
|
|
open class C {
|
|
internal open fun foo() {}
|
|
}
|
|
|
|
interface T {
|
|
fun foo() {}
|
|
}
|
|
|
|
class D : C(), T {
|
|
protected override fun foo() {}
|
|
}
|
|
|
|
class E : C(), T {
|
|
internal override fun foo() {}
|
|
}
|
|
|
|
class F : C(), T {
|
|
<!INCOMPATIBLE_MODIFIERS!>private<!> <!INCOMPATIBLE_MODIFIERS!>override<!> fun foo() {}
|
|
}
|
|
|
|
class G : C(), T {
|
|
public override fun foo() {}
|
|
} |