[FE] Report ambiguity when label can refer to multiple receivers
This commit is contained in:
committed by
TeamCityServer
parent
fd7d000138
commit
ac27fda965
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +ContextReceivers
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun List<Int>.decimateEveryEvenThird() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>sequence<!> {
|
||||
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +ContextReceivers
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun List<Int>.decimateEveryEvenThird() = sequence {
|
||||
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
fun List<Int>.f() {
|
||||
this<!UNRESOLVED_LABEL!>@List<!>.size
|
||||
}
|
||||
|
||||
context(String)
|
||||
fun Int.f() {
|
||||
this<!UNRESOLVED_LABEL!>@String<!>.length
|
||||
this<!UNRESOLVED_LABEL!>@Int<!>.toDouble()
|
||||
}
|
||||
|
||||
context(String)
|
||||
val p: String get() = this<!UNRESOLVED_LABEL!>@String<!>
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
fun List<Int>.f() {
|
||||
this<!UNRESOLVED_REFERENCE!>@List<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>size<!>
|
||||
}
|
||||
|
||||
<!UNSUPPORTED_FEATURE!>context(String)<!>
|
||||
fun Int.f() {
|
||||
this<!UNRESOLVED_REFERENCE!>@String<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||
this<!UNRESOLVED_REFERENCE!>@Int<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>toDouble<!>()
|
||||
}
|
||||
|
||||
<!UNSUPPORTED_FEATURE!>context(String)<!>
|
||||
val p: String get() = this<!UNRESOLVED_REFERENCE!>@String<!>
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
package
|
||||
|
||||
public val p: kotlin.String
|
||||
public fun kotlin.Int.f(): kotlin.Unit
|
||||
public fun kotlin.collections.List<kotlin.Int>.f(): kotlin.Unit
|
||||
+11
-1
@@ -4,7 +4,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() {
|
||||
context(A<String>) fun A<Int>.f() {
|
||||
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>context(A<String>, B) fun f()<!> {
|
||||
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
||||
this<!UNRESOLVED_LABEL!>@B<!>.b
|
||||
<!NO_THIS!>this<!>
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>context(A<Int>, A<String>, B) fun f()<!> {
|
||||
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
||||
this<!UNRESOLVED_LABEL!>@B<!>.b
|
||||
<!NO_THIS!>this<!>
|
||||
|
||||
Vendored
+13
-3
@@ -4,16 +4,26 @@ class A<T>(val a: T)
|
||||
class B(val b: Any)
|
||||
class C(val c: Any)
|
||||
|
||||
context(A<Int>, A<String>, B) fun f() {
|
||||
context(A<String>) fun A<Int>.f() {
|
||||
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||
}
|
||||
|
||||
context(A<String>, B) fun f() {
|
||||
this@A.a.length
|
||||
this@B.b
|
||||
<!NO_THIS!>this<!>
|
||||
}
|
||||
|
||||
context(A<Int>, A<String>, B) fun f() {
|
||||
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||
this@B.b
|
||||
<!NO_THIS!>this<!>
|
||||
}
|
||||
|
||||
context(A<Int>, A<String>, B) fun C.f() {
|
||||
this@A.a.length
|
||||
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||
this@B.b
|
||||
this@C.c
|
||||
this@f.c
|
||||
this.c
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
@@ -1,6 +1,8 @@
|
||||
package
|
||||
|
||||
public fun f(): kotlin.Unit
|
||||
public fun f(): kotlin.Unit
|
||||
public fun A<kotlin.Int>.f(): kotlin.Unit
|
||||
public fun C.f(): kotlin.Unit
|
||||
|
||||
public final class A</*0*/ T> {
|
||||
@@ -26,3 +28,4 @@ public final class C {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
|
||||
+15
-1
@@ -4,7 +4,21 @@ class A<T>(val a: T)
|
||||
class B(val b: Any)
|
||||
class C(val c: Any)
|
||||
|
||||
<!MUST_BE_INITIALIZED!>context(A<Int>, A<String>, B) var p: Int<!>
|
||||
<!MUST_BE_INITIALIZED!>context(A<String>, B) var <!REDECLARATION!>p<!>: Int<!>
|
||||
get() {
|
||||
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
||||
this<!UNRESOLVED_LABEL!>@B<!>.b
|
||||
<!NO_THIS!>this<!>
|
||||
return 1
|
||||
}
|
||||
set(value) {
|
||||
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
||||
this<!UNRESOLVED_LABEL!>@B<!>.b
|
||||
<!NO_THIS!>this<!>
|
||||
field = value
|
||||
}
|
||||
|
||||
<!MUST_BE_INITIALIZED!>context(A<Int>, A<String>, B) var <!REDECLARATION!>p<!>: Int<!>
|
||||
get() {
|
||||
this<!UNRESOLVED_LABEL!>@A<!>.a.toDouble()
|
||||
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
||||
|
||||
Vendored
+18
-4
@@ -4,9 +4,8 @@ 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
|
||||
context(A<String>, B) var p: Int
|
||||
get() {
|
||||
this@A.a.<!UNRESOLVED_REFERENCE!>toDouble<!>()
|
||||
this@A.a.length
|
||||
this@B.b
|
||||
<!NO_THIS!>this<!>
|
||||
@@ -19,12 +18,27 @@ context(A<Int>, A<String>, B) var p: Int
|
||||
<!UNRESOLVED_REFERENCE!>field<!> = value
|
||||
}
|
||||
|
||||
context(A<Int>, A<String>, B) var p: Int
|
||||
get() {
|
||||
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>toDouble<!>()
|
||||
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||
this@B.b
|
||||
<!NO_THIS!>this<!>
|
||||
return 1
|
||||
}
|
||||
set(value) {
|
||||
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>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<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||
this@B.b
|
||||
this@C.c
|
||||
this@p.c
|
||||
this.c
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsProperties.txt
Vendored
+1
@@ -1,5 +1,6 @@
|
||||
package
|
||||
|
||||
public var p: kotlin.Int
|
||||
public var p: kotlin.Int
|
||||
public val C.p: kotlin.Int
|
||||
|
||||
|
||||
Reference in New Issue
Block a user