[FE] Support context receivers on classes
This commit is contained in:
committed by
TeamCityServer
parent
c34fe8d547
commit
f4ddf66ac4
+13
@@ -0,0 +1,13 @@
|
||||
context(T) class A<T>
|
||||
|
||||
context(Collection<P>) class B<P>
|
||||
|
||||
fun Int.foo() {
|
||||
A<Int>()
|
||||
A<String>()
|
||||
}
|
||||
|
||||
fun Collection<Int>.bar() {
|
||||
B<Int>()
|
||||
B<String>()
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
context(T) class A<T>
|
||||
|
||||
context(Collection<P>) class B<P>
|
||||
|
||||
fun Int.foo() {
|
||||
A<Int>()
|
||||
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>A<!><String>()
|
||||
}
|
||||
|
||||
fun Collection<Int>.bar() {
|
||||
B<Int>()
|
||||
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>B<!><String>()
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun kotlin.collections.Collection<kotlin.Int>.bar(): kotlin.Unit
|
||||
public fun kotlin.Int.foo(): kotlin.Unit
|
||||
|
||||
public final class A</*0*/ T> {
|
||||
public constructor A</*0*/ T>()
|
||||
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
|
||||
}
|
||||
|
||||
public final class B</*0*/ P> {
|
||||
public constructor B</*0*/ P>()
|
||||
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
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class Outer {
|
||||
val x: Int = 1
|
||||
}
|
||||
|
||||
context(Outer)
|
||||
class Inner(arg: Any) {
|
||||
fun bar() = <!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
|
||||
fun f(outer: Outer) {
|
||||
Inner(1)
|
||||
with(outer) {
|
||||
Inner(3)
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class Outer {
|
||||
val x: Int = 1
|
||||
}
|
||||
|
||||
context(Outer)
|
||||
class Inner(arg: Any) {
|
||||
fun bar() = x
|
||||
}
|
||||
|
||||
fun f(outer: Outer) {
|
||||
<!NO_CONTEXT_RECEIVER!>Inner(1)<!>
|
||||
with(outer) {
|
||||
Inner(3)
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package
|
||||
|
||||
public fun f(/*0*/ outer: Outer): kotlin.Unit
|
||||
|
||||
public final class Inner {
|
||||
public constructor Inner(/*0*/ arg: kotlin.Any)
|
||||
public final fun bar(): kotlin.Int
|
||||
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
|
||||
}
|
||||
|
||||
public final class Outer {
|
||||
public constructor Outer()
|
||||
public final val x: kotlin.Int = 1
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user