Use Visibilities.isVisible with ReceiverValue.

This commit is contained in:
Stanislav Erokhin
2014-10-16 16:30:13 +04:00
parent f640f82ed0
commit f9afdf7540
18 changed files with 305 additions and 13 deletions
@@ -0,0 +1,39 @@
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) {}
{
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<!>())
}
class 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<!>())
}