1ed79d534f
#KT-151 Fixed Visibilities.INHERITED constant added (occurs only during resolve), changed after overridden descriptors resolve Fake descriptors are created for invisible properties as well (is necessary for better error reporting)
40 lines
669 B
Plaintext
40 lines
669 B
Plaintext
//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() {}
|
|
}
|
|
|
|
trait T {
|
|
protected fun foo() {}
|
|
}
|
|
|
|
class D : C(), T {
|
|
<!CANNOT_CHANGE_ACCESS_PRIVILEGE!>protected<!> override fun foo() {}
|
|
}
|
|
|
|
class E : C(), T {
|
|
<!CANNOT_CHANGE_ACCESS_PRIVILEGE!>internal<!> override fun foo() {}
|
|
}
|
|
|
|
class F : C(), T {
|
|
<!CANNOT_WEAKEN_ACCESS_PRIVILEGE!>private<!> override fun foo() {}
|
|
}
|
|
|
|
class G : C(), T {
|
|
override fun foo() {}
|
|
} |