[PSI, FE, PSI2IR] Use labels for referencing specific receiver
This commit is contained in:
committed by
TeamCityServer
parent
aaabf5e1ca
commit
1bcaeabd84
+19
@@ -0,0 +1,19 @@
|
||||
interface Context {
|
||||
fun h() {}
|
||||
}
|
||||
|
||||
open class A {
|
||||
open fun f() {}
|
||||
}
|
||||
|
||||
class B : A() {
|
||||
override fun f() {}
|
||||
|
||||
context(Context)
|
||||
inner class C {
|
||||
fun g() {
|
||||
super@B.f()
|
||||
super@Context.<!UNRESOLVED_REFERENCE!>h<!>()
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
interface Context {
|
||||
fun h() {}
|
||||
}
|
||||
|
||||
open class A {
|
||||
open fun f() {}
|
||||
}
|
||||
|
||||
class B : A() {
|
||||
override fun f() {}
|
||||
|
||||
context(Context)
|
||||
inner class C {
|
||||
fun g() {
|
||||
super@B.f()
|
||||
<!DEBUG_INFO_MISSING_UNRESOLVED!>super<!><!UNRESOLVED_REFERENCE!>@Context<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>h<!>()
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package
|
||||
|
||||
public open class A {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun f(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class B : A {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ fun f(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final inner class C {
|
||||
public constructor C()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun g(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public interface Context {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun h(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class A(val a: String?)
|
||||
|
||||
context(A) fun f() {
|
||||
if (<!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>a<!> == null) return
|
||||
<!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>a<!>.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class A(val a: String?)
|
||||
|
||||
context(A) fun f() {
|
||||
if (this@A.a == null) return
|
||||
<!DEBUG_INFO_SMARTCAST!>this@A.a<!>.length
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
public fun f(): kotlin.Unit
|
||||
|
||||
public final class A {
|
||||
public constructor A(/*0*/ a: kotlin.String?)
|
||||
public final val a: kotlin.String?
|
||||
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
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
class A<T>(val a: T)
|
||||
class B(val b: Any)
|
||||
class C(val c: Any)
|
||||
|
||||
context(labelAInt@A<Int>, A<String>, labelB@B) fun f() {
|
||||
<!UNRESOLVED_LABEL!>this@labelAInt<!>.<!UNRESOLVED_REFERENCE!>a<!>.<!UNRESOLVED_REFERENCE!>toFloat<!>()
|
||||
<!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>a<!>.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
<!UNRESOLVED_LABEL!>this@labelB<!>.<!UNRESOLVED_REFERENCE!>b<!>
|
||||
<!UNRESOLVED_LABEL!>this@B<!>
|
||||
}
|
||||
|
||||
context(labelAInt@A<Int>, A<String>, labelB@B) val C.p: Int
|
||||
get() {
|
||||
<!UNRESOLVED_LABEL!>this@labelAInt<!>.<!UNRESOLVED_REFERENCE!>a<!>.<!UNRESOLVED_REFERENCE!>toFloat<!>()
|
||||
<!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>a<!>.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
<!UNRESOLVED_LABEL!>this@B<!>
|
||||
<!UNRESOLVED_LABEL!>this@labelB<!>.<!UNRESOLVED_REFERENCE!>b<!>
|
||||
<!UNRESOLVED_LABEL!>this@C<!>.<!UNRESOLVED_REFERENCE!>c<!>
|
||||
this@p.c
|
||||
this.c
|
||||
return 1
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
class A<T>(val a: T)
|
||||
class B(val b: Any)
|
||||
class C(val c: Any)
|
||||
|
||||
context(labelAInt@A<Int>, A<String>, labelB@B) fun f() {
|
||||
this@labelAInt.a.toFloat()
|
||||
this@A.a.length
|
||||
this@labelB.b
|
||||
this<!UNRESOLVED_REFERENCE!>@B<!>
|
||||
}
|
||||
|
||||
context(labelAInt@A<Int>, A<String>, labelB@B) val C.p: Int
|
||||
get() {
|
||||
this@labelAInt.a.toFloat()
|
||||
this@A.a.length
|
||||
this<!UNRESOLVED_REFERENCE!>@B<!>
|
||||
this@labelB.b
|
||||
this@C.c
|
||||
this@p.c
|
||||
this.c
|
||||
return 1
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package
|
||||
|
||||
public val C.p: kotlin.Int
|
||||
public fun f(): kotlin.Unit
|
||||
|
||||
public final class A</*0*/ T> {
|
||||
public constructor A</*0*/ T>(/*0*/ a: T)
|
||||
public final val a: 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 {
|
||||
public constructor B(/*0*/ b: kotlin.Any)
|
||||
public final val b: kotlin.Any
|
||||
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 C {
|
||||
public constructor C(/*0*/ c: kotlin.Any)
|
||||
public final val c: kotlin.Any
|
||||
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
|
||||
}
|
||||
compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsClasses.fir.kt
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
val x = 1
|
||||
}
|
||||
|
||||
context(A) class B {
|
||||
val prop = <!UNRESOLVED_REFERENCE!>x<!> + <!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>x<!>
|
||||
|
||||
fun f() = <!UNRESOLVED_REFERENCE!>x<!> + <!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
val x = 1
|
||||
}
|
||||
|
||||
context(A) class B {
|
||||
val prop = x + this<!UNRESOLVED_REFERENCE!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>x<!>
|
||||
|
||||
fun f() = x + this<!UNRESOLVED_REFERENCE!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>x<!>
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public final class A {
|
||||
public constructor A()
|
||||
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
|
||||
}
|
||||
|
||||
public final class B {
|
||||
public constructor B()
|
||||
public final val prop: [ERROR : Type for x + this@A.x]
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun f(): [ERROR : Error function type]
|
||||
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 @@
|
||||
class A<T>(val a: T)
|
||||
class B(val b: Any)
|
||||
class C(val c: Any)
|
||||
|
||||
context(A<Int>, A<String>, B) fun f() {
|
||||
<!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>a<!>.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
<!UNRESOLVED_LABEL!>this@B<!>.<!UNRESOLVED_REFERENCE!>b<!>
|
||||
<!NO_THIS!>this<!>
|
||||
}
|
||||
|
||||
context(A<Int>, A<String>, B) fun C.f() {
|
||||
<!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>a<!>.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
<!UNRESOLVED_LABEL!>this@B<!>.<!UNRESOLVED_REFERENCE!>b<!>
|
||||
<!UNRESOLVED_LABEL!>this@C<!>.<!UNRESOLVED_REFERENCE!>c<!>
|
||||
this@f.c
|
||||
this.c
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
class A<T>(val a: T)
|
||||
class B(val b: Any)
|
||||
class C(val c: Any)
|
||||
|
||||
context(A<Int>, A<String>, B) fun f() {
|
||||
this@A.a.length
|
||||
this@B.b
|
||||
<!NO_THIS!>this<!>
|
||||
}
|
||||
|
||||
context(A<Int>, A<String>, B) fun C.f() {
|
||||
this@A.a.length
|
||||
this@B.b
|
||||
this@C.c
|
||||
this@f.c
|
||||
this.c
|
||||
}
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
package
|
||||
|
||||
public fun f(): kotlin.Unit
|
||||
public fun C.f(): kotlin.Unit
|
||||
|
||||
public final class A</*0*/ T> {
|
||||
public constructor A</*0*/ T>(/*0*/ a: T)
|
||||
public final val a: 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 {
|
||||
public constructor B(/*0*/ b: kotlin.Any)
|
||||
public final val b: kotlin.Any
|
||||
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 C {
|
||||
public constructor C(/*0*/ c: kotlin.Any)
|
||||
public final val c: kotlin.Any
|
||||
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
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
class A<T>(val a: T)
|
||||
class B(val b: Any)
|
||||
class C(val c: Any)
|
||||
|
||||
context(A<Int>, A<String>, B) var p: Int
|
||||
get() {
|
||||
<!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>a<!>.<!UNRESOLVED_REFERENCE!>toDouble<!>()
|
||||
<!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>a<!>.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
<!UNRESOLVED_LABEL!>this@B<!>.<!UNRESOLVED_REFERENCE!>b<!>
|
||||
<!NO_THIS!>this<!>
|
||||
return 1
|
||||
}
|
||||
set(value) {
|
||||
<!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>a<!>.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
<!UNRESOLVED_LABEL!>this@B<!>.<!UNRESOLVED_REFERENCE!>b<!>
|
||||
<!NO_THIS!>this<!>
|
||||
field = value
|
||||
}
|
||||
|
||||
context(A<Int>, A<String>, B) val C.p: Int
|
||||
get() {
|
||||
<!UNRESOLVED_LABEL!>this@A<!>.<!UNRESOLVED_REFERENCE!>a<!>.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
<!UNRESOLVED_LABEL!>this@B<!>.<!UNRESOLVED_REFERENCE!>b<!>
|
||||
<!UNRESOLVED_LABEL!>this@C<!>.<!UNRESOLVED_REFERENCE!>c<!>
|
||||
this@p.c
|
||||
this.c
|
||||
return 1
|
||||
}
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
class A<T>(val a: T)
|
||||
class B(val b: Any)
|
||||
class C(val c: Any)
|
||||
|
||||
context(A<Int>, A<String>, B) var p: Int
|
||||
get() {
|
||||
this@A.a.<!UNRESOLVED_REFERENCE!>toDouble<!>()
|
||||
this@A.a.length
|
||||
this@B.b
|
||||
<!NO_THIS!>this<!>
|
||||
return 1
|
||||
}
|
||||
set(value) {
|
||||
this@A.a.length
|
||||
this@B.b
|
||||
<!NO_THIS!>this<!>
|
||||
<!UNRESOLVED_REFERENCE!>field<!> = value
|
||||
}
|
||||
|
||||
context(A<Int>, A<String>, B) val C.p: Int
|
||||
get() {
|
||||
this@A.a.length
|
||||
this@B.b
|
||||
this@C.c
|
||||
this@p.c
|
||||
this.c
|
||||
return 1
|
||||
}
|
||||
compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsProperties.txt
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
package
|
||||
|
||||
public var p: kotlin.Int
|
||||
public val C.p: kotlin.Int
|
||||
|
||||
public final class A</*0*/ T> {
|
||||
public constructor A</*0*/ T>(/*0*/ a: T)
|
||||
public final val a: 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 {
|
||||
public constructor B(/*0*/ b: kotlin.Any)
|
||||
public final val b: kotlin.Any
|
||||
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 C {
|
||||
public constructor C(/*0*/ c: kotlin.Any)
|
||||
public final val c: kotlin.Any
|
||||
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