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<!>())
}
@@ -0,0 +1,24 @@
package
internal fun </*0*/ T> getT(): T
internal fun </*0*/ I> test(/*0*/ t: Test<I>): kotlin.Unit
internal fun </*0*/ T, /*1*/ R> with(/*0*/ receiver: T, /*1*/ f: T.() -> R): R
internal final class Test</*0*/ in I> {
public constructor Test</*0*/ in I>()
internal final fun apply(/*0*/ i: I): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
private/*private to this*/ final fun foo(): I
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
internal final fun test(): kotlin.Unit
internal final fun </*0*/ I> test(/*0*/ t: Test<I>): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
internal class object <class-object-for-Test> {
private constructor <class-object-for-Test>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
internal final fun </*0*/ I> test(/*0*/ t: Test<I>): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,38 @@
fun <T> getT(): T = null!!
fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
class Test<in I, out O> {
private val i: I = getT()
;{
apply(i)
apply(this.i)
}
fun apply(<!UNUSED_PARAMETER!>i<!>: I) {}
fun test() {
apply(i)
apply(this.i)
with(Test<I, O>()) {
apply(i) // resolved to this@Test.i
apply(this.<!INVISIBLE_MEMBER(i; private/*private to this*/; Test)!>i<!>)
apply(this@with.<!INVISIBLE_MEMBER(i; private/*private to this*/; Test)!>i<!>)
apply(this@Test.i)
}
}
fun <I, O> test(t: Test<I, O>) {
t.apply(t.<!INVISIBLE_MEMBER(i; private/*private to this*/; Test)!>i<!>)
}
class object {
fun <I, O> test(t: Test<I, O>) {
t.apply(t.<!INVISIBLE_MEMBER(i; private/*private to this*/; Test)!>i<!>)
}
}
}
fun <I, O> test(t: Test<I, O>) {
t.apply(t.<!INVISIBLE_MEMBER(i; private/*private to this*/; Test)!>i<!>)
}
@@ -0,0 +1,24 @@
package
internal fun </*0*/ T> getT(): T
internal fun </*0*/ I, /*1*/ O> test(/*0*/ t: Test<I, O>): kotlin.Unit
internal fun </*0*/ T, /*1*/ R> with(/*0*/ receiver: T, /*1*/ f: T.() -> R): R
internal final class Test</*0*/ in I, /*1*/ out O> {
public constructor Test</*0*/ in I, /*1*/ out O>()
private/*private to this*/ final val i: I
internal final fun apply(/*0*/ i: I): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
internal final fun test(): kotlin.Unit
internal final fun </*0*/ I, /*1*/ O> test(/*0*/ t: Test<I, O>): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
internal class object <class-object-for-Test> {
private constructor <class-object-for-Test>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
internal final fun </*0*/ I, /*1*/ O> test(/*0*/ t: Test<I, O>): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,38 @@
fun <T> getT(): T = null!!
fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
class Test<in I, out O> {
private var i: I = getT()
private val j: I
;{
j = getT()
i = getT()
this.i = getT()
}
fun test() {
i = getT()
this.i = getT()
with(Test<I, O>()) {
i = getT() // resolved to this@Test.i
this.<!INVISIBLE_MEMBER(i; private/*private to this*/; Test)!>i<!> = getT()
this@with.<!INVISIBLE_MEMBER(i; private/*private to this*/; Test)!>i<!> = getT()
this@Test.i = getT()
}
}
fun <I, O> test(t: Test<I, O>) {
t.<!INVISIBLE_MEMBER(i; private/*private to this*/; Test)!>i<!> = getT()
}
class object {
fun <I, O> test(t: Test<I, O>) {
t.<!INVISIBLE_MEMBER(i; private/*private to this*/; Test)!>i<!> = getT()
}
}
}
fun <I, O> test(t: Test<I, O>) {
t.<!INVISIBLE_MEMBER(i; private/*private to this*/; Test)!>i<!> = getT()
}
@@ -0,0 +1,24 @@
package
internal fun </*0*/ T> getT(): T
internal fun </*0*/ I, /*1*/ O> test(/*0*/ t: Test<I, O>): kotlin.Unit
internal fun </*0*/ T, /*1*/ R> with(/*0*/ receiver: T, /*1*/ f: T.() -> R): R
internal final class Test</*0*/ in I, /*1*/ out O> {
public constructor Test</*0*/ in I, /*1*/ out O>()
private/*private to this*/ final var i: I
private/*private to this*/ final val j: I
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
internal final fun test(): kotlin.Unit
internal final fun </*0*/ I, /*1*/ O> test(/*0*/ t: Test<I, O>): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
internal class object <class-object-for-Test> {
private constructor <class-object-for-Test>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
internal final fun </*0*/ I, /*1*/ O> test(/*0*/ t: Test<I, O>): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -0,0 +1,20 @@
fun <T> getT(): T = null!!
class A<in I>(init: I) {
private val i: I
{
i = getT()
}
private var i2 = i
private val i3: I
private var i4 = getT<I>()
;{
i2 = getT()
i3 = init
i4 = i3
}
}
@@ -0,0 +1,14 @@
package
internal fun </*0*/ T> getT(): T
internal final class A</*0*/ in I> {
public constructor A</*0*/ in I>(/*0*/ init: I)
private/*private to this*/ final val i: I
private/*private to this*/ final var i2: I
private/*private to this*/ final val i3: I
private/*private to this*/ final var i4: I
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}