Files
kotlin-fork/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.kt
T
Denis Zharkov f07566d30d Add warning for initializers with obsolete syntax
Expected 'init' keyword before class initializer
2015-03-11 17:45:26 +03:00

39 lines
1.0 KiB
Kotlin

fun <T> getT(): T = null!!
fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
class Test<in I> {
private fun foo() : I = getT()
fun apply(<!UNUSED_PARAMETER!>i<!>: I) {}
init {
foo()
this.foo()
}
fun test() {
apply(foo())
apply(this.foo())
with(Test<I>()) {
apply(foo()) // resolved to this@Test.foo
apply(this.<!INVISIBLE_MEMBER(foo; private/*private to this*/; Test)!>foo<!>())
apply(this@with.<!INVISIBLE_MEMBER(foo; private/*private to this*/; Test)!>foo<!>())
apply(this@Test.foo())
}
}
fun <I> test(t: Test<I>) {
t.apply(t.<!INVISIBLE_MEMBER(foo; private/*private to this*/; Test)!>foo<!>())
}
default object {
fun <I> test(t: Test<I>) {
t.apply(t.<!INVISIBLE_MEMBER(foo; private/*private to this*/; Test)!>foo<!>())
}
}
}
fun <I> test(t: Test<I>) {
t.apply(t.<!INVISIBLE_MEMBER(foo; private/*private to this*/; Test)!>foo<!>())
}