FIR: Fix overload resolution with context receivers
This commit is contained in:
compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.fir.kt
Vendored
+2
-2
@@ -10,9 +10,9 @@ fun f(): Unit<!> = TODO()
|
||||
fun f(): Unit<!> = TODO()
|
||||
|
||||
fun test(a: A, b: B) {
|
||||
with(a) {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(a) {
|
||||
with(b) {
|
||||
f()
|
||||
<!ARGUMENT_TYPE_MISMATCH!><!OVERLOAD_RESOLUTION_AMBIGUITY!>f<!>()<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
// !LANGUAGE: +ContextReceivers
|
||||
|
||||
class Context
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>context(Context)
|
||||
fun f(): String<!> = TODO()
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun f(): Any<!> = TODO()
|
||||
|
||||
fun test() {
|
||||
with(Context()) {
|
||||
f().length
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +ContextReceivers
|
||||
|
||||
class Context
|
||||
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
// !LANGUAGE: +ContextReceivers
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>context(Int, String)
|
||||
fun foo(): Int<!> {
|
||||
return this@Int + 42
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>context(Int)
|
||||
fun foo(): Int<!> {
|
||||
return this@Int + 42
|
||||
}
|
||||
|
||||
fun test() {
|
||||
with(42) {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +ContextReceivers
|
||||
|
||||
context(Int, String)
|
||||
|
||||
+3
-3
@@ -5,16 +5,16 @@ class B(val b: Any)
|
||||
class C(val c: Any)
|
||||
|
||||
context(A<String>) fun A<Int>.f() {
|
||||
this@A.a.length
|
||||
this@A.a.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>context(A<String>, B) fun f()<!> {
|
||||
context(A<String>, B) fun f() {
|
||||
this@A.a.length
|
||||
this@B.b
|
||||
<!NO_THIS!>this<!>
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>context(A<Int>, A<String>, B) fun f()<!> {
|
||||
context(A<Int>, A<String>, B) fun f() {
|
||||
this@A.a.length
|
||||
this@B.b
|
||||
<!NO_THIS!>this<!>
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ class A {
|
||||
fun useWithContextReceivers() {
|
||||
with(42) {
|
||||
with("") {
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>f<!>({}, 42)
|
||||
f({}, 42)
|
||||
sameAsFWithoutNonContextualCounterpart({}, 42)
|
||||
p
|
||||
val a = A()
|
||||
|
||||
Reference in New Issue
Block a user