[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
@@ -27,9 +27,22 @@ inline fun Int.testInlineWithExtensionAndMultipleArgs(<this>: Context, i1: Int,
return <this>.plus(other = i1).plus(other = i2).plus(other = <this>.c())
}
inline fun Int.testInlineWithExtensionAndMultipleContextsAndArgs(<this>: Context, <this>: Any, i1: Int = 1, i2: Int = 2): Int {
class A {
constructor(a: Any?) /* primary */ {
super/*Any*/()
/* <init>() */
}
val a: Any?
field = a
get
}
inline fun Int.testInlineWithExtensionAndMultipleContextsAndArgs(<this>: Context, <this>: A, i1: Int = 1, i2: Int = 2): Int {
return <this>.plus(other = i1).plus(other = i2).plus(other = <this>.c()).plus(other = when {
EQEQ(arg0 = <this>, arg1 = null) -> 0
EQEQ(arg0 = <this>.<get-a>(), arg1 = null) -> 0
else -> 1
})
}
@@ -41,7 +54,7 @@ fun box(): String {
result = result.plus(other = testInlineWithArg(<this> = $this$with, i = 1))
result = result.plus(other = 1.testInlineWithExtensionAndArg(<this> = $this$with, i = 1))
result = result.plus(other = 1.testInlineWithExtensionAndMultipleArgs(<this> = $this$with, i1 = 1, i2 = 2))
with<Int, Unit>(receiver = 1, block = local fun Int.<anonymous>() {
with<A, Unit>(receiver = A(a = 1), block = local fun A.<anonymous>() {
result = result.plus(other = 1.testInlineWithExtensionAndMultipleContextsAndArgs(<this> = $this$with, <this> = $this$with, i1 = 1, i2 = 2))
result = result.plus(other = 1.testInlineWithExtensionAndMultipleContextsAndArgs(<this> = $this$with, <this> = $this$with))
}