Files
kotlin-fork/compiler/testData/ir/irText/declarations/contextReceivers/compoundAssignmentOperators.kt.txt
T
2024-02-16 10:19:38 +00:00

136 lines
3.9 KiB
Kotlin
Vendored

var operationScore: Int
field = 0
get
set
data class Result {
var i: Int
field = i
get
set
constructor(i: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
operator fun component1(): Int {
return <this>.#i
}
fun copy(i: Int = <this>.#i): Result {
return Result(i = i)
}
override operator fun equals(other: Any?): Boolean {
when {
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
}
when {
other !is Result -> return false
}
val tmp_0: Result = other as Result
when {
EQEQ(arg0 = <this>.#i, arg1 = tmp_0.#i).not() -> return false
}
return true
}
override fun hashCode(): Int {
return <this>.#i.hashCode()
}
override fun toString(): String {
return "Result(" + "i=" + <this>.#i + ")"
}
}
fun box(): String {
val result: Result = Result(i = 0)
with<Int, Unit>(receiver = 1, block = local fun Int.<anonymous>() {
result.plusAssign($context_receiver_0 = $this$with, other = Result(i = 1).plus($context_receiver_0 = $this$with, other = Result(i = 1)))
result.minusAssign($context_receiver_0 = $this$with, other = Result(i = 1).minus($context_receiver_0 = $this$with, other = Result(i = 0)))
result.timesAssign($context_receiver_0 = $this$with, other = Result(i = 1).times($context_receiver_0 = $this$with, other = Result(i = 2)))
result.divAssign($context_receiver_0 = $this$with, other = Result(i = 4).div($context_receiver_0 = $this$with, other = Result(i = 2)))
}
)
return when {
when {
EQEQ(arg0 = result.<get-i>(), arg1 = 1) -> EQEQ(arg0 = <get-operationScore>(), arg1 = 8)
else -> false
} -> "OK"
else -> "fail"
}
}
operator fun Result.div($context_receiver_0: Int, other: Result): Result {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = $context_receiver_0))
}
return Result(i = <this>.<get-i>().div(other = other.<get-i>()))
}
operator fun Result.divAssign($context_receiver_0: Int, other: Result) {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = $context_receiver_0))
}
{ // BLOCK
val tmp_1: Result = <this>
tmp_1.<set-i>(<set-?> = tmp_1.<get-i>().div(other = other.<get-i>()))
}
}
operator fun Result.minus($context_receiver_0: Int, other: Result): Result {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = $context_receiver_0))
}
return Result(i = <this>.<get-i>().minus(other = other.<get-i>()))
}
operator fun Result.minusAssign($context_receiver_0: Int, other: Result) {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = $context_receiver_0))
}
{ // BLOCK
val tmp_2: Result = <this>
tmp_2.<set-i>(<set-?> = tmp_2.<get-i>().minus(other = other.<get-i>()))
}
}
operator fun Result.plus($context_receiver_0: Int, other: Result): Result {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = $context_receiver_0))
}
return Result(i = <this>.<get-i>().plus(other = other.<get-i>()))
}
operator fun Result.plusAssign($context_receiver_0: Int, other: Result) {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = $context_receiver_0))
}
{ // BLOCK
val tmp_3: Result = <this>
tmp_3.<set-i>(<set-?> = tmp_3.<get-i>().plus(other = other.<get-i>()))
}
}
operator fun Result.times($context_receiver_0: Int, other: Result): Result {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = $context_receiver_0))
}
return Result(i = <this>.<get-i>().times(other = other.<get-i>()))
}
operator fun Result.timesAssign($context_receiver_0: Int, other: Result) {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = $context_receiver_0))
}
{ // BLOCK
val tmp_4: Result = <this>
tmp_4.<set-i>(<set-?> = tmp_4.<get-i>().times(other = other.<get-i>()))
}
}