Files
kotlin-fork/compiler/testData/diagnostics/tests/scopes/kt151.kt
T
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00

41 lines
724 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.<!INVISIBLE_MEMBER!>x<!>()
}
//more tests
open class C {
internal open fun foo() {}
}
interface T {
fun foo() {}
}
class D : C(), T {
<!CANNOT_CHANGE_ACCESS_PRIVILEGE!>protected<!> override fun foo() {}
}
class E : C(), T {
<!CANNOT_WEAKEN_ACCESS_PRIVILEGE!>internal<!> override fun foo() {}
}
class F : C(), T {
<!CANNOT_WEAKEN_ACCESS_PRIVILEGE, INCOMPATIBLE_MODIFIERS!>private<!> <!INCOMPATIBLE_MODIFIERS!>override<!> fun foo() {}
}
class G : C(), T {
public override fun foo() {}
}