FIR: Support typeRef-name label for this

This commit is contained in:
Denis.Zharkov
2022-03-24 14:58:11 +03:00
committed by teamcity
parent ac399321f0
commit 512446843b
13 changed files with 38 additions and 108 deletions
@@ -1,12 +0,0 @@
// !LANGUAGE: +ContextReceivers
// WITH_STDLIB
fun List<Int>.decimateEveryEvenThird() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>sequence<!> {
var counter = 1
for (e in <!ITERATOR_AMBIGUITY!>this<!UNRESOLVED_LABEL!>@List<!><!>) {
if (e <!NONE_APPLICABLE!>%<!> 2 == 0 && counter % 3 == 0) {
yield(e)
}
counter += 1
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +ContextReceivers
// WITH_STDLIB
@@ -1,72 +0,0 @@
// !LANGUAGE: +ContextReceivers
class Param
class C {
val c = 42
}
class R {
val r = 42
}
context(C)
fun R.f1(g: context(C) R.(Param) -> Unit) {
g(this@C, this<!UNRESOLVED_LABEL!>@R<!>, Param())
}
context(C)
fun f2(g: context(C) (Param) -> Unit) {
g(this@C, Param())
}
context(C)
fun R.f3(g: context(C) R.() -> Unit) {
g(this@C, this<!UNRESOLVED_LABEL!>@R<!>)
}
context(C)
fun f4(g: context(C) () -> Unit) {
g(this@C)
}
fun test() {
val lf1: context(C) R.(Param) -> Unit = { _ ->
r
c
}
val lf2: context(C) (Param) -> Unit = { _ ->
c
}
val lf3: context(C) R.() -> Unit = {
r
c
}
val lf4: context(C) () -> Unit = {
c
}
with(C()) {
with(R()) {
f1(lf1)
f1 { _ ->
r
c
}
f2(lf2)
f2 { _ ->
c
}
f3(lf3)
f3 {
r
c
}
f4(lf4)
f4 {
c
}
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +ContextReceivers
class Param
@@ -1,11 +1,11 @@
fun List<Int>.f() {
this<!UNRESOLVED_LABEL!>@List<!>.size
this@List.size
}
context(String)
fun Int.f() {
this@String.length
this<!UNRESOLVED_LABEL!>@Int<!>.toDouble()
this@Int.toDouble()
}
context(String)
@@ -1,27 +1,27 @@
fun Int.f() {
this<!UNRESOLVED_LABEL!>@Int<!>
this@Int
}
var Int.p: Int
get() {
this<!UNRESOLVED_LABEL!>@Int<!>
this@Int
<!RETURN_NOT_ALLOWED!>return@p<!> 42
}
set(value) {
this<!UNRESOLVED_LABEL!>@Int<!>
this@Int
}
class X {
var Int.p: Int
get() {
this<!UNRESOLVED_LABEL!>@Int<!>
this@Int
<!RETURN_NOT_ALLOWED!>return@p<!> 42
}
set(value) {
this<!UNRESOLVED_LABEL!>@Int<!>
this@Int
}
fun Int.f() {
this<!UNRESOLVED_LABEL!>@Int<!>
this@Int
}
}
@@ -17,7 +17,7 @@ context(labelAInt@A<Int>, A<String>, labelB@B) val C.p: Int
this@A.a.length
this<!UNRESOLVED_LABEL!>@B<!>
this@labelB.b
this<!UNRESOLVED_LABEL!>@C<!>.c
this@C.c
this@p.c
this.c
return 1
@@ -23,7 +23,7 @@ context(A<Int>, A<String>, B) fun f() {
context(A<Int>, A<String>, B) fun C.f() {
this@A.a.length
this@B.b
this<!UNRESOLVED_LABEL!>@C<!>.c
this@C.c
this@f.c
this.c
}
@@ -37,7 +37,7 @@ context(A<Int>, A<String>, B) val C.p: Int
get() {
this@A.a.length
this@B.b
this<!UNRESOLVED_LABEL!>@C<!>.c
this@C.c
this@p.c
this.c
return 1