[Tests] Fix contextualInlineCall.kt to avoid subtyping relation error

This commit is contained in:
Anastasia.Shadrina
2022-03-31 15:06:35 +07:00
committed by teamcity
parent d857142514
commit a3fa2dc9bf
6 changed files with 136 additions and 39 deletions
@@ -18,9 +18,11 @@ inline fun Int.testInlineWithExtensionAndArg(i: Int) = this@Int + i + c()
context(Context)
inline fun Int.testInlineWithExtensionAndMultipleArgs(i1: Int, i2: Int) = this@Int + i1 + i2 + c()
context(Context, Any)
class A(val a: Any?)
context(Context, A)
inline fun Int.testInlineWithExtensionAndMultipleContextsAndArgs(i1: Int = 1, i2: Int = 2) =
this@Int + i1 + i2 + c() + if (this@Any == null) 0 else 1
this@Int + i1 + i2 + c() + if (this@A.a == null) 0 else 1
fun box(): String = with(Context()) {
var result = 0
@@ -28,7 +30,7 @@ fun box(): String = with(Context()) {
result += testInlineWithArg(1)
result += 1.testInlineWithExtensionAndArg(1)
result += 1.testInlineWithExtensionAndMultipleArgs(1, 2)
with(1) {
with(A(1)) {
result += 1.testInlineWithExtensionAndMultipleContextsAndArgs(1, 2)
result += 1.testInlineWithExtensionAndMultipleContextsAndArgs()
}