[FE] Provide overloadability for candidates with different CR

This commit is contained in:
Anastasiya Shadrina
2021-09-18 19:00:37 +07:00
committed by TeamCityServer
parent 155e7b211b
commit a091b345a0
12 changed files with 108 additions and 6 deletions
@@ -0,0 +1,21 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
context(Int, String)
fun foo(): String = "O"
context(Int)
fun foo(): String = "K"
fun box(): String {
val o = with ("") {
with(42) {
foo()
}
}
val k = with(42) {
foo()
}
return o + k
}
@@ -0,0 +1,17 @@
// !LANGUAGE: +ContextReceivers
<!CONFLICTING_OVERLOADS!>context(Int, String)
fun foo(): Int<!> {
return <!RETURN_TYPE_MISMATCH!>this<!UNRESOLVED_LABEL!>@Int<!> + 42<!>
}
<!CONFLICTING_OVERLOADS!>context(Int)
fun foo(): Int<!> {
return <!RETURN_TYPE_MISMATCH!>this<!UNRESOLVED_LABEL!>@Int<!> + 42<!>
}
fun test() {
with(42) {
foo()
}
}
@@ -0,0 +1,17 @@
// !LANGUAGE: +ContextReceivers
context(Int, String)
fun foo(): Int {
return this@Int + 42
}
context(Int)
fun foo(): Int {
return this@Int + 42
}
fun test() {
with(42) {
foo()
}
}
@@ -0,0 +1,5 @@
package
public fun foo(): kotlin.Int
public fun foo(): kotlin.Int
public fun test(): kotlin.Unit