Files
kotlin-fork/compiler/testData/ir/irText/declarations/contextReceivers/compoundAssignmentOperators.fir.kt.txt
T
2022-04-06 16:05:40 +00:00

107 lines
3.6 KiB
Plaintext
Vendored

data class Result {
constructor(i: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
var i: Int
field = i
get
set
operator fun component1(): Int {
return <this>.#i
}
fun copy(i: Int = <this>.#i): Result {
return Result(i = i)
}
override fun equals(other: Any?): Boolean {
when {
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
}
when {
other !is Result -> return false
}
val tmp0_other_with_cast: Result = other as Result
when {
EQEQ(arg0 = <this>.#i, arg1 = tmp0_other_with_cast.#i).not() -> return false
}
return true
}
override fun hashCode(): Int {
return <this>.#i.hashCode()
}
override fun toString(): String {
return "Result(" + "i=" + <this>.#i + ")"
}
}
var operationScore: Int
field = 0
get
set
operator fun Result.plus(_context_receiver_0: Int, other: Result): Result {
<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) {
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = _context_receiver_0))
<this>.<set-i>(<set-?> = <this>.<get-i>().plus(other = other.<get-i>()))
}
operator fun Result.minus(_context_receiver_0: Int, other: Result): Result {
<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) {
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = _context_receiver_0))
<this>.<set-i>(<set-?> = <this>.<get-i>().minus(other = other.<get-i>()))
}
operator fun Result.times(_context_receiver_0: Int, other: Result): Result {
<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) {
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = _context_receiver_0))
<this>.<set-i>(<set-?> = <this>.<get-i>().times(other = other.<get-i>()))
}
operator fun Result.div(_context_receiver_0: Int, other: Result): Result {
<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) {
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = _context_receiver_0))
<this>.<set-i>(<set-?> = <this>.<get-i>().div(other = other.<get-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"
}
}