e6b5cb5216
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
96 lines
1.6 KiB
Kotlin
Vendored
96 lines
1.6 KiB
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
|
|
//FILE:a.kt
|
|
package test_visibility
|
|
|
|
<!WRONG_MODIFIER_CONTAINING_DECLARATION!>protected<!> class ProtectedClass
|
|
<!WRONG_MODIFIER_CONTAINING_DECLARATION!>protected<!> interface ProtectedTrait
|
|
|
|
<!WRONG_MODIFIER_TARGET!>protected<!> val protected_val : Int = 4
|
|
<!WRONG_MODIFIER_TARGET!>protected<!> fun protected_fun() {}
|
|
|
|
private val private_val : Int = 4
|
|
private fun private_fun() {}
|
|
|
|
val internal_val : Int = 34
|
|
fun internal_fun() {}
|
|
|
|
fun test1() {
|
|
private_fun();
|
|
}
|
|
|
|
class Y {
|
|
fun test2() {
|
|
private_fun();
|
|
}
|
|
}
|
|
|
|
class A {
|
|
private val i = 23
|
|
private val v: B = B()
|
|
private fun f(i: Int): B = B()
|
|
|
|
fun test() {
|
|
doSmth(i)
|
|
}
|
|
}
|
|
|
|
class B {
|
|
fun bMethod() {}
|
|
}
|
|
|
|
fun test3(a: A) {
|
|
a.<!INVISIBLE_MEMBER("v; private; 'A'")!>v<!> //todo .bMethod()
|
|
a.<!INVISIBLE_MEMBER("f; private; 'A'")!>f<!>(0, <!TOO_MANY_ARGUMENTS!>1<!>) //todo .bMethod()
|
|
}
|
|
|
|
interface T
|
|
|
|
open class C : T {
|
|
protected var i : Int = 34
|
|
fun test5() {
|
|
doSmth(i)
|
|
}
|
|
}
|
|
|
|
fun test4(c: C) {
|
|
c.<!INVISIBLE_MEMBER("i; protected; 'C'")!>i<!>++
|
|
}
|
|
|
|
class D : C() {
|
|
val j = i
|
|
fun test6() {
|
|
doSmth(i)
|
|
}
|
|
}
|
|
|
|
class E : C() {
|
|
fun test7() {
|
|
doSmth(i)
|
|
}
|
|
}
|
|
|
|
class F : C() {
|
|
fun test8(c: C) {
|
|
doSmth(c.<!INVISIBLE_MEMBER!>i<!>)
|
|
}
|
|
}
|
|
|
|
class G : T {
|
|
fun test8(c: C) {
|
|
doSmth(c.<!INVISIBLE_MEMBER("i; protected; 'C'")!>i<!>)
|
|
}
|
|
}
|
|
|
|
fun doSmth(i: Int) = i
|
|
|
|
//FILE:b.kt
|
|
package test_visibility2
|
|
|
|
import test_visibility.*
|
|
|
|
fun test() {
|
|
internal_fun()
|
|
<!INVISIBLE_MEMBER("private_fun; private; file")!>private_fun<!>()
|
|
}
|