[Tests] Make sure desugaring works with context receivers

This commit is contained in:
Anastasiya Shadrina
2021-11-17 17:39:49 +07:00
committed by TeamCityServer
parent 0bfea4fc52
commit 4d0eb74d79
29 changed files with 2740 additions and 0 deletions
@@ -0,0 +1,219 @@
FILE fqName:<root> fileName:/arrayAccessCompositeOperators.kt
CLASS CLASS name:MyContainer modality:FINAL visibility:public [data] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyContainer
CONSTRUCTOR visibility:public <> (i:kotlin.Int) returnType:<root>.MyContainer [primary]
VALUE_PARAMETER name:i index:0 type:kotlin.Int
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyContainer modality:FINAL visibility:public [data] superTypes:[kotlin.Any]'
PROPERTY name:i visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private
EXPRESSION_BODY
GET_VAR 'i: kotlin.Int declared in <root>.MyContainer.<init>' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-i> visibility:public modality:FINAL <> ($this:<root>.MyContainer) returnType:kotlin.Int
correspondingProperty: PROPERTY name:i visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-i> (): kotlin.Int declared in <root>.MyContainer'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.<get-i>' type=<root>.MyContainer origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-i> visibility:public modality:FINAL <> ($this:<root>.MyContainer, <set-?>:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:i visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.<set-i>' type=<root>.MyContainer origin=null
value: GET_VAR '<set-?>: kotlin.Int declared in <root>.MyContainer.<set-i>' type=kotlin.Int origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:<root>.MyContainer) returnType:kotlin.Int [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int [operator] declared in <root>.MyContainer'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.component1' type=<root>.MyContainer origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:<root>.MyContainer, i:kotlin.Int) returnType:<root>.MyContainer
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
VALUE_PARAMETER name:i index:0 type:kotlin.Int
EXPRESSION_BODY
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.copy' type=<root>.MyContainer origin=null
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun copy (i: kotlin.Int): <root>.MyContainer declared in <root>.MyContainer'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.MyContainer' type=<root>.MyContainer origin=null
i: GET_VAR 'i: kotlin.Int declared in <root>.MyContainer.copy' type=kotlin.Int origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:<root>.MyContainer) returnType:kotlin.String
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.MyContainer'
STRING_CONCATENATION type=kotlin.String
CONST String type=kotlin.String value="MyContainer("
CONST String type=kotlin.String value="i="
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.toString' type=<root>.MyContainer origin=null
CONST String type=kotlin.String value=")"
FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:<root>.MyContainer) returnType:kotlin.Int
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in <root>.MyContainer'
CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.hashCode' type=<root>.MyContainer origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:<root>.MyContainer, other:kotlin.Any?) returnType:kotlin.Boolean [operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
BLOCK_BODY
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ
arg0: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.equals' type=<root>.MyContainer origin=null
arg1: GET_VAR 'other: kotlin.Any? declared in <root>.MyContainer.equals' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.MyContainer'
CONST Boolean type=kotlin.Boolean value=true
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=<root>.MyContainer
GET_VAR 'other: kotlin.Any? declared in <root>.MyContainer.equals' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.MyContainer'
CONST Boolean type=kotlin.Boolean value=false
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.MyContainer [val]
TYPE_OP type=<root>.MyContainer origin=CAST typeOperand=<root>.MyContainer
GET_VAR 'other: kotlin.Any? declared in <root>.MyContainer.equals' type=kotlin.Any? origin=null
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.equals' type=<root>.MyContainer origin=null
arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR 'val tmp_0: <root>.MyContainer [val] declared in <root>.MyContainer.equals' type=<root>.MyContainer origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.MyContainer'
CONST Boolean type=kotlin.Boolean value=false
RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.MyContainer'
CONST Boolean type=kotlin.Boolean value=true
PROPERTY name:operationScore visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=0
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-operationScore> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:operationScore visibility:public modality:FINAL [var]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-operationScore> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]' type=kotlin.Int origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-operationScore> visibility:public modality:FINAL <> (<set-?>:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:operationScore visibility:public modality:FINAL [var]
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null
value: GET_VAR '<set-?>: kotlin.Int declared in <root>.<set-operationScore>' type=kotlin.Int origin=null
FUN name:get visibility:public modality:FINAL <> ($receiver:<root>.MyContainer, <this>:kotlin.Int, index:kotlin.Int) returnType:kotlin.Int [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.MyContainer
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:index index:1 type:kotlin.Int
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.get' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun get (<this>: kotlin.Int, index: kotlin.Int): kotlin.Int [operator] declared in <root>'
WHEN type=kotlin.Int origin=IF
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'index: kotlin.Int declared in <root>.get' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=0
then: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.MyContainer' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.MyContainer declared in <root>.get' type=<root>.MyContainer origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Int type=kotlin.Int value=-1
FUN name:plusAssign visibility:public modality:FINAL <> ($receiver:<root>.MyContainer, <this>:kotlin.Int, other:<root>.MyContainer) returnType:kotlin.Unit [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.MyContainer
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:other index:1 type:<root>.MyContainer
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.plusAssign' type=kotlin.Int origin=null
BLOCK type=kotlin.Unit origin=PLUSEQ
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:<root>.MyContainer [val]
GET_VAR '<this>: <root>.MyContainer declared in <root>.plusAssign' type=<root>.MyContainer origin=null
CALL 'public final fun <set-i> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.MyContainer' type=kotlin.Unit origin=PLUSEQ
$this: GET_VAR 'val tmp_1: <root>.MyContainer [val] declared in <root>.plusAssign' type=<root>.MyContainer origin=null
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.MyContainer' type=kotlin.Int origin=PLUSEQ
$this: GET_VAR 'val tmp_1: <root>.MyContainer [val] declared in <root>.plusAssign' type=<root>.MyContainer origin=null
other: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.MyContainer' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'other: <root>.MyContainer declared in <root>.plusAssign' type=<root>.MyContainer origin=null
FUN name:inc visibility:public modality:FINAL <> ($receiver:<root>.MyContainer, <this>:kotlin.Int) returnType:<root>.MyContainer [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.MyContainer
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.inc' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun inc (<this>: kotlin.Int): <root>.MyContainer [operator] declared in <root>'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.MyContainer' type=<root>.MyContainer origin=null
i: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.MyContainer' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.MyContainer declared in <root>.inc' type=<root>.MyContainer origin=null
other: CONST Int type=kotlin.Int value=1
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
VAR name:myContainer type:<root>.MyContainer [var]
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.MyContainer' type=<root>.MyContainer origin=null
i: CONST Int type=kotlin.Int value=0
CALL 'public final fun with <T, R> (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1<T of kotlin.StandardKt.with, R of kotlin.StandardKt.with>): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null
<T>: kotlin.Int
<R>: kotlin.Unit
receiver: CONST Int type=kotlin.Int value=1
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:$this$with type:kotlin.Int
BLOCK_BODY
CALL 'public final fun plusAssign (<this>: kotlin.Int, other: <root>.MyContainer): kotlin.Unit [operator] declared in <root>' type=kotlin.Unit origin=PLUSEQ
$receiver: GET_VAR 'var myContainer: <root>.MyContainer [var] declared in <root>.box' type=<root>.MyContainer origin=PLUSEQ
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
other: CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.MyContainer' type=<root>.MyContainer origin=null
i: CALL 'public final fun get (<this>: kotlin.Int, index: kotlin.Int): kotlin.Int [operator] declared in <root>' type=kotlin.Int origin=GET_ARRAY_ELEMENT
$receiver: BLOCK type=<root>.MyContainer origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:<root>.MyContainer [val]
GET_VAR 'var myContainer: <root>.MyContainer [var] declared in <root>.box' type=<root>.MyContainer origin=POSTFIX_INCR
SET_VAR 'var myContainer: <root>.MyContainer [var] declared in <root>.box' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (<this>: kotlin.Int): <root>.MyContainer [operator] declared in <root>' type=<root>.MyContainer origin=POSTFIX_INCR
$receiver: GET_VAR 'val tmp_2: <root>.MyContainer [val] declared in <root>.box.<anonymous>' type=<root>.MyContainer origin=null
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
GET_VAR 'val tmp_2: <root>.MyContainer [val] declared in <root>.box.<anonymous>' type=<root>.MyContainer origin=null
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
index: CONST Int type=kotlin.Int value=0
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
WHEN type=kotlin.String origin=IF
BRANCH
if: WHEN type=kotlin.Boolean origin=ANDAND
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.MyContainer' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'var myContainer: <root>.MyContainer [var] declared in <root>.box' type=<root>.MyContainer origin=null
arg1: CONST Int type=kotlin.Int value=1
then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=GET_PROPERTY
arg1: CONST Int type=kotlin.Int value=3
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Boolean type=kotlin.Boolean value=false
then: CONST String type=kotlin.String value="OK"
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST String type=kotlin.String value="fail"
@@ -0,0 +1,33 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
data class MyContainer(var i: Int)
var operationScore = 0
context(Int)
operator fun MyContainer.get(index: Int): Int {
operationScore += this@Int
return if (index == 0) i else -1
}
context(Int)
operator fun MyContainer.plusAssign(other: MyContainer) {
operationScore += this@Int
i += other.i
}
context(Int)
operator fun MyContainer.inc(): MyContainer {
operationScore += this@Int
return MyContainer(i + 1)
}
fun box(): String {
var myContainer = MyContainer(0)
with(1) {
myContainer += MyContainer(myContainer++[0])
}
return if (myContainer.i == 1 && operationScore == 3) "OK" else "fail"
}
@@ -0,0 +1,94 @@
data class MyContainer {
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): MyContainer {
return MyContainer(i = i)
}
override fun toString(): String {
return "MyContainer(" + "i=" + <this>.#i + ")"
}
override fun hashCode(): Int {
return <this>.#i.hashCode()
}
override operator fun equals(other: Any?): Boolean {
when {
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
}
when {
other !is MyContainer -> return false
}
val tmp0_other_with_cast: MyContainer = other as MyContainer
when {
EQEQ(arg0 = <this>.#i, arg1 = tmp0_other_with_cast.#i).not() -> return false
}
return true
}
}
var operationScore: Int
field = 0
get
set
operator fun MyContainer.get(<this>: Int, index: Int): Int {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
return when {
EQEQ(arg0 = index, arg1 = 0) -> <this>.<get-i>()
else -> -1
}
}
operator fun MyContainer.plusAssign(<this>: Int, other: MyContainer) {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
{ // BLOCK
val tmp0_this: MyContainer = <this>
tmp0_this.<set-i>(<set-?> = tmp0_this.<get-i>().plus(other = other.<get-i>()))
}
}
operator fun MyContainer.inc(<this>: Int): MyContainer {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
return MyContainer(i = <this>.<get-i>().plus(other = 1))
}
fun box(): String {
var myContainer: MyContainer = MyContainer(i = 0)
with<Int, Unit>(receiver = 1, block = local fun Int.<anonymous>() {
myContainer.plusAssign(<this> = $this$with, other = MyContainer(i = { // BLOCK
val tmp0: MyContainer = myContainer
myContainer = tmp0.inc(<this> = $this$with)
tmp0
}.get(<this> = $this$with, index = 0)))
}
)
return when {
when {
EQEQ(arg0 = myContainer.<get-i>(), arg1 = 1) -> EQEQ(arg0 = <get-operationScore>(), arg1 = 3)
else -> false
} -> "OK"
else -> "fail"
}
}
@@ -0,0 +1,185 @@
FILE fqName:<root> fileName:/arrayAccessOperators.kt
CLASS CLASS name:MyContainer modality:FINAL visibility:public [data] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyContainer
CONSTRUCTOR visibility:public <> (s:kotlin.String) returnType:<root>.MyContainer [primary]
VALUE_PARAMETER name:s index:0 type:kotlin.String
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyContainer modality:FINAL visibility:public [data] superTypes:[kotlin.Any]'
PROPERTY name:s visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.String visibility:private
EXPRESSION_BODY
GET_VAR 's: kotlin.String declared in <root>.MyContainer.<init>' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-s> visibility:public modality:FINAL <> ($this:<root>.MyContainer) returnType:kotlin.String
correspondingProperty: PROPERTY name:s visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-s> (): kotlin.String declared in <root>.MyContainer'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.String visibility:private' type=kotlin.String origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.<get-s>' type=<root>.MyContainer origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-s> visibility:public modality:FINAL <> ($this:<root>.MyContainer, <set-?>:kotlin.String) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:s visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.String
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.String visibility:private' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.<set-s>' type=<root>.MyContainer origin=null
value: GET_VAR '<set-?>: kotlin.String declared in <root>.MyContainer.<set-s>' type=kotlin.String origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:<root>.MyContainer) returnType:kotlin.String [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.String [operator] declared in <root>.MyContainer'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.String visibility:private' type=kotlin.String origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.component1' type=<root>.MyContainer origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:<root>.MyContainer, s:kotlin.String) returnType:<root>.MyContainer
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
VALUE_PARAMETER name:s index:0 type:kotlin.String
EXPRESSION_BODY
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.String visibility:private' type=kotlin.String origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.copy' type=<root>.MyContainer origin=null
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun copy (s: kotlin.String): <root>.MyContainer declared in <root>.MyContainer'
CONSTRUCTOR_CALL 'public constructor <init> (s: kotlin.String) [primary] declared in <root>.MyContainer' type=<root>.MyContainer origin=null
s: GET_VAR 's: kotlin.String declared in <root>.MyContainer.copy' type=kotlin.String origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:<root>.MyContainer) returnType:kotlin.String
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.MyContainer'
STRING_CONCATENATION type=kotlin.String
CONST String type=kotlin.String value="MyContainer("
CONST String type=kotlin.String value="s="
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.String visibility:private' type=kotlin.String origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.toString' type=<root>.MyContainer origin=null
CONST String type=kotlin.String value=")"
FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:<root>.MyContainer) returnType:kotlin.Int
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in <root>.MyContainer'
CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.String' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.String visibility:private' type=kotlin.String origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.hashCode' type=<root>.MyContainer origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:<root>.MyContainer, other:kotlin.Any?) returnType:kotlin.Boolean [operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.MyContainer
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
BLOCK_BODY
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ
arg0: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.equals' type=<root>.MyContainer origin=null
arg1: GET_VAR 'other: kotlin.Any? declared in <root>.MyContainer.equals' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.MyContainer'
CONST Boolean type=kotlin.Boolean value=true
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=<root>.MyContainer
GET_VAR 'other: kotlin.Any? declared in <root>.MyContainer.equals' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.MyContainer'
CONST Boolean type=kotlin.Boolean value=false
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.MyContainer [val]
TYPE_OP type=<root>.MyContainer origin=CAST typeOperand=<root>.MyContainer
GET_VAR 'other: kotlin.Any? declared in <root>.MyContainer.equals' type=kotlin.Any? origin=null
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.String visibility:private' type=kotlin.String origin=null
receiver: GET_VAR '<this>: <root>.MyContainer declared in <root>.MyContainer.equals' type=<root>.MyContainer origin=null
arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:s type:kotlin.String visibility:private' type=kotlin.String origin=null
receiver: GET_VAR 'val tmp_0: <root>.MyContainer [val] declared in <root>.MyContainer.equals' type=<root>.MyContainer origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.MyContainer'
CONST Boolean type=kotlin.Boolean value=false
RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.MyContainer'
CONST Boolean type=kotlin.Boolean value=true
FUN name:get visibility:public modality:FINAL <> ($receiver:<root>.MyContainer, <this>:kotlin.Int, index:kotlin.Int) returnType:kotlin.String? [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.MyContainer
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:index index:1 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun get (<this>: kotlin.Int, index: kotlin.Int): kotlin.String? [operator] declared in <root>'
WHEN type=kotlin.String? origin=IF
BRANCH
if: WHEN type=kotlin.Boolean origin=ANDAND
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'index: kotlin.Int declared in <root>.get' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=0
then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR '<this>: kotlin.Int declared in <root>.get' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=42
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Boolean type=kotlin.Boolean value=false
then: CALL 'public final fun <get-s> (): kotlin.String declared in <root>.MyContainer' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.MyContainer declared in <root>.get' type=<root>.MyContainer origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Null type=kotlin.Nothing? value=null
FUN name:set visibility:public modality:FINAL <> ($receiver:<root>.MyContainer, <this>:kotlin.Int, index:kotlin.Int, value:kotlin.String) returnType:kotlin.Unit [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.MyContainer
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:index index:1 type:kotlin.Int
VALUE_PARAMETER name:value index:2 type:kotlin.String
BLOCK_BODY
WHEN type=kotlin.Unit origin=IF
BRANCH
if: WHEN type=kotlin.Boolean origin=OROR
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_VAR 'index: kotlin.Int declared in <root>.set' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=0
then: CONST Boolean type=kotlin.Boolean value=true
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_VAR '<this>: kotlin.Int declared in <root>.set' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=42
then: RETURN type=kotlin.Nothing from='public final fun set (<this>: kotlin.Int, index: kotlin.Int, value: kotlin.String): kotlin.Unit [operator] declared in <root>'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
CALL 'public final fun <set-s> (<set-?>: kotlin.String): kotlin.Unit declared in <root>.MyContainer' type=kotlin.Unit origin=EQ
$this: GET_VAR '<this>: <root>.MyContainer declared in <root>.set' type=<root>.MyContainer origin=null
<set-?>: GET_VAR 'value: kotlin.String declared in <root>.set' type=kotlin.String origin=null
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CALL 'public final fun with <T, R> (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1<T of kotlin.StandardKt.with, R of kotlin.StandardKt.with>): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.String origin=null
<T>: kotlin.Int
<R>: kotlin.String
receiver: CONST Int type=kotlin.Int value=42
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<kotlin.Int, kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.String
$receiver: VALUE_PARAMETER name:$this$with type:kotlin.Int
BLOCK_BODY
VAR name:myContainer type:<root>.MyContainer [val]
CONSTRUCTOR_CALL 'public constructor <init> (s: kotlin.String) [primary] declared in <root>.MyContainer' type=<root>.MyContainer origin=null
s: CONST String type=kotlin.String value="fail"
CALL 'public final fun set (<this>: kotlin.Int, index: kotlin.Int, value: kotlin.String): kotlin.Unit [operator] declared in <root>' type=kotlin.Unit origin=EQ
$receiver: GET_VAR 'val myContainer: <root>.MyContainer [val] declared in <root>.box.<anonymous>' type=<root>.MyContainer origin=null
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
index: CONST Int type=kotlin.Int value=0
value: CONST String type=kotlin.String value="OK"
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.box'
BLOCK type=kotlin.String origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.String? [val]
CALL 'public final fun get (<this>: kotlin.Int, index: kotlin.Int): kotlin.String? [operator] declared in <root>' type=kotlin.String? origin=GET_ARRAY_ELEMENT
$receiver: GET_VAR 'val myContainer: <root>.MyContainer [val] declared in <root>.box.<anonymous>' type=<root>.MyContainer origin=null
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
index: CONST Int type=kotlin.Int value=0
WHEN type=kotlin.String origin=null
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_1: kotlin.String? [val] declared in <root>.box.<anonymous>' type=kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST String type=kotlin.String value="fail"
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val tmp_1: kotlin.String? [val] declared in <root>.box.<anonymous>' type=kotlin.String? origin=null
@@ -0,0 +1,24 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
data class MyContainer(var s: String)
context(Int)
operator fun MyContainer.get(index: Int): String? {
return if (index == 0 && this@Int == 42) s else null
}
context(Int)
operator fun MyContainer.set(index: Int, value: String) {
if (index != 0 || this@Int != 42) return
s = value
}
fun box(): String {
return with(42) {
val myContainer = MyContainer("fail")
myContainer[0] = "OK"
myContainer[0] ?: "fail"
}
}
@@ -0,0 +1,78 @@
data class MyContainer {
constructor(s: String) /* primary */ {
super/*Any*/()
/* <init>() */
}
var s: String
field = s
get
set
operator fun component1(): String {
return <this>.#s
}
fun copy(s: String = <this>.#s): MyContainer {
return MyContainer(s = s)
}
override fun toString(): String {
return "MyContainer(" + "s=" + <this>.#s + ")"
}
override fun hashCode(): Int {
return <this>.#s.hashCode()
}
override operator fun equals(other: Any?): Boolean {
when {
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
}
when {
other !is MyContainer -> return false
}
val tmp0_other_with_cast: MyContainer = other as MyContainer
when {
EQEQ(arg0 = <this>.#s, arg1 = tmp0_other_with_cast.#s).not() -> return false
}
return true
}
}
operator fun MyContainer.get(<this>: Int, index: Int): String? {
return when {
when {
EQEQ(arg0 = index, arg1 = 0) -> EQEQ(arg0 = <this>, arg1 = 42)
else -> false
} -> <this>.<get-s>()
else -> null
}
}
operator fun MyContainer.set(<this>: Int, index: Int, value: String) {
when {
when {
EQEQ(arg0 = index, arg1 = 0).not() -> true
else -> EQEQ(arg0 = <this>, arg1 = 42).not()
} -> return Unit
}
<this>.<set-s>(<set-?> = value)
}
fun box(): String {
return with<Int, String>(receiver = 42, block = local fun Int.<anonymous>(): String {
val myContainer: MyContainer = MyContainer(s = "fail")
myContainer.set(<this> = $this$with, index = 0, value = "OK")
return { // BLOCK
val tmp0_elvis_lhs: String? = myContainer.get(<this> = $this$with, index = 0)
when {
EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> "fail"
else -> tmp0_elvis_lhs
}
}
}
)
}
@@ -0,0 +1,337 @@
FILE fqName:<root> fileName:/compoundAssignmentOperators.kt
CLASS CLASS name:Result modality:FINAL visibility:public [data] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Result
CONSTRUCTOR visibility:public <> (i:kotlin.Int) returnType:<root>.Result [primary]
VALUE_PARAMETER name:i index:0 type:kotlin.Int
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Result modality:FINAL visibility:public [data] superTypes:[kotlin.Any]'
PROPERTY name:i visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private
EXPRESSION_BODY
GET_VAR 'i: kotlin.Int declared in <root>.Result.<init>' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-i> visibility:public modality:FINAL <> ($this:<root>.Result) returnType:kotlin.Int
correspondingProperty: PROPERTY name:i visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.Result
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-i> (): kotlin.Int declared in <root>.Result'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.<get-i>' type=<root>.Result origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-i> visibility:public modality:FINAL <> ($this:<root>.Result, <set-?>:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:i visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.<set-i>' type=<root>.Result origin=null
value: GET_VAR '<set-?>: kotlin.Int declared in <root>.Result.<set-i>' type=kotlin.Int origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:<root>.Result) returnType:kotlin.Int [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.Result
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int [operator] declared in <root>.Result'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.component1' type=<root>.Result origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:<root>.Result, i:kotlin.Int) returnType:<root>.Result
$this: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:i index:0 type:kotlin.Int
EXPRESSION_BODY
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.copy' type=<root>.Result origin=null
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun copy (i: kotlin.Int): <root>.Result declared in <root>.Result'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: GET_VAR 'i: kotlin.Int declared in <root>.Result.copy' type=kotlin.Int origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:<root>.Result) returnType:kotlin.String
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.Result
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.Result'
STRING_CONCATENATION type=kotlin.String
CONST String type=kotlin.String value="Result("
CONST String type=kotlin.String value="i="
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.toString' type=<root>.Result origin=null
CONST String type=kotlin.String value=")"
FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:<root>.Result) returnType:kotlin.Int
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.Result
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in <root>.Result'
CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.hashCode' type=<root>.Result origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:<root>.Result, other:kotlin.Any?) returnType:kotlin.Boolean [operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
BLOCK_BODY
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ
arg0: GET_VAR '<this>: <root>.Result declared in <root>.Result.equals' type=<root>.Result origin=null
arg1: GET_VAR 'other: kotlin.Any? declared in <root>.Result.equals' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Result'
CONST Boolean type=kotlin.Boolean value=true
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=<root>.Result
GET_VAR 'other: kotlin.Any? declared in <root>.Result.equals' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Result'
CONST Boolean type=kotlin.Boolean value=false
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.Result [val]
TYPE_OP type=<root>.Result origin=CAST typeOperand=<root>.Result
GET_VAR 'other: kotlin.Any? declared in <root>.Result.equals' type=kotlin.Any? origin=null
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.equals' type=<root>.Result origin=null
arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR 'val tmp_0: <root>.Result [val] declared in <root>.Result.equals' type=<root>.Result origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Result'
CONST Boolean type=kotlin.Boolean value=false
RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Result'
CONST Boolean type=kotlin.Boolean value=true
PROPERTY name:operationScore visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=0
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-operationScore> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:operationScore visibility:public modality:FINAL [var]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-operationScore> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]' type=kotlin.Int origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-operationScore> visibility:public modality:FINAL <> (<set-?>:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:operationScore visibility:public modality:FINAL [var]
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null
value: GET_VAR '<set-?>: kotlin.Int declared in <root>.<set-operationScore>' type=kotlin.Int origin=null
FUN name:plus visibility:public modality:FINAL <> ($receiver:<root>.Result, <this>:kotlin.Int, other:<root>.Result) returnType:<root>.Result [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:other index:1 type:<root>.Result
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.plus' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun plus (<this>: kotlin.Int, other: <root>.Result): <root>.Result [operator] declared in <root>'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Result declared in <root>.plus' type=<root>.Result origin=null
other: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'other: <root>.Result declared in <root>.plus' type=<root>.Result origin=null
FUN name:plusAssign visibility:public modality:FINAL <> ($receiver:<root>.Result, <this>:kotlin.Int, other:<root>.Result) returnType:kotlin.Unit [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:other index:1 type:<root>.Result
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.plusAssign' type=kotlin.Int origin=null
BLOCK type=kotlin.Unit origin=PLUSEQ
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:<root>.Result [val]
GET_VAR '<this>: <root>.Result declared in <root>.plusAssign' type=<root>.Result origin=null
CALL 'public final fun <set-i> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.Result' type=kotlin.Unit origin=PLUSEQ
$this: GET_VAR 'val tmp_1: <root>.Result [val] declared in <root>.plusAssign' type=<root>.Result origin=null
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=PLUSEQ
$this: GET_VAR 'val tmp_1: <root>.Result [val] declared in <root>.plusAssign' type=<root>.Result origin=null
other: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'other: <root>.Result declared in <root>.plusAssign' type=<root>.Result origin=null
FUN name:minus visibility:public modality:FINAL <> ($receiver:<root>.Result, <this>:kotlin.Int, other:<root>.Result) returnType:<root>.Result [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:other index:1 type:<root>.Result
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.minus' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun minus (<this>: kotlin.Int, other: <root>.Result): <root>.Result [operator] declared in <root>'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CALL 'public final fun minus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MINUS
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Result declared in <root>.minus' type=<root>.Result origin=null
other: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'other: <root>.Result declared in <root>.minus' type=<root>.Result origin=null
FUN name:minusAssign visibility:public modality:FINAL <> ($receiver:<root>.Result, <this>:kotlin.Int, other:<root>.Result) returnType:kotlin.Unit [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:other index:1 type:<root>.Result
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.minusAssign' type=kotlin.Int origin=null
BLOCK type=kotlin.Unit origin=MINUSEQ
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:<root>.Result [val]
GET_VAR '<this>: <root>.Result declared in <root>.minusAssign' type=<root>.Result origin=null
CALL 'public final fun <set-i> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.Result' type=kotlin.Unit origin=MINUSEQ
$this: GET_VAR 'val tmp_2: <root>.Result [val] declared in <root>.minusAssign' type=<root>.Result origin=null
<set-?>: CALL 'public final fun minus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MINUSEQ
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=MINUSEQ
$this: GET_VAR 'val tmp_2: <root>.Result [val] declared in <root>.minusAssign' type=<root>.Result origin=null
other: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'other: <root>.Result declared in <root>.minusAssign' type=<root>.Result origin=null
FUN name:times visibility:public modality:FINAL <> ($receiver:<root>.Result, <this>:kotlin.Int, other:<root>.Result) returnType:<root>.Result [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:other index:1 type:<root>.Result
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.times' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun times (<this>: kotlin.Int, other: <root>.Result): <root>.Result [operator] declared in <root>'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Result declared in <root>.times' type=<root>.Result origin=null
other: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'other: <root>.Result declared in <root>.times' type=<root>.Result origin=null
FUN name:timesAssign visibility:public modality:FINAL <> ($receiver:<root>.Result, <this>:kotlin.Int, other:<root>.Result) returnType:kotlin.Unit [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:other index:1 type:<root>.Result
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.timesAssign' type=kotlin.Int origin=null
BLOCK type=kotlin.Unit origin=MULTEQ
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:<root>.Result [val]
GET_VAR '<this>: <root>.Result declared in <root>.timesAssign' type=<root>.Result origin=null
CALL 'public final fun <set-i> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.Result' type=kotlin.Unit origin=MULTEQ
$this: GET_VAR 'val tmp_3: <root>.Result [val] declared in <root>.timesAssign' type=<root>.Result origin=null
<set-?>: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MULTEQ
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=MULTEQ
$this: GET_VAR 'val tmp_3: <root>.Result [val] declared in <root>.timesAssign' type=<root>.Result origin=null
other: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'other: <root>.Result declared in <root>.timesAssign' type=<root>.Result origin=null
FUN name:div visibility:public modality:FINAL <> ($receiver:<root>.Result, <this>:kotlin.Int, other:<root>.Result) returnType:<root>.Result [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:other index:1 type:<root>.Result
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.div' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun div (<this>: kotlin.Int, other: <root>.Result): <root>.Result [operator] declared in <root>'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CALL 'public final fun div (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=DIV
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Result declared in <root>.div' type=<root>.Result origin=null
other: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'other: <root>.Result declared in <root>.div' type=<root>.Result origin=null
FUN name:divAssign visibility:public modality:FINAL <> ($receiver:<root>.Result, <this>:kotlin.Int, other:<root>.Result) returnType:kotlin.Unit [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:other index:1 type:<root>.Result
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.divAssign' type=kotlin.Int origin=null
BLOCK type=kotlin.Unit origin=DIVEQ
VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:<root>.Result [val]
GET_VAR '<this>: <root>.Result declared in <root>.divAssign' type=<root>.Result origin=null
CALL 'public final fun <set-i> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.Result' type=kotlin.Unit origin=DIVEQ
$this: GET_VAR 'val tmp_4: <root>.Result [val] declared in <root>.divAssign' type=<root>.Result origin=null
<set-?>: CALL 'public final fun div (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=DIVEQ
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=DIVEQ
$this: GET_VAR 'val tmp_4: <root>.Result [val] declared in <root>.divAssign' type=<root>.Result origin=null
other: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'other: <root>.Result declared in <root>.divAssign' type=<root>.Result origin=null
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
VAR name:result type:<root>.Result [val]
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CONST Int type=kotlin.Int value=0
CALL 'public final fun with <T, R> (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1<T of kotlin.StandardKt.with, R of kotlin.StandardKt.with>): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null
<T>: kotlin.Int
<R>: kotlin.Unit
receiver: CONST Int type=kotlin.Int value=1
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:$this$with type:kotlin.Int
BLOCK_BODY
CALL 'public final fun plusAssign (<this>: kotlin.Int, other: <root>.Result): kotlin.Unit [operator] declared in <root>' type=kotlin.Unit origin=PLUSEQ
$receiver: GET_VAR 'val result: <root>.Result [val] declared in <root>.box' type=<root>.Result origin=PLUSEQ
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
other: CALL 'public final fun plus (<this>: kotlin.Int, other: <root>.Result): <root>.Result [operator] declared in <root>' type=<root>.Result origin=PLUS
$receiver: CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CONST Int type=kotlin.Int value=1
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
other: CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CONST Int type=kotlin.Int value=1
CALL 'public final fun minusAssign (<this>: kotlin.Int, other: <root>.Result): kotlin.Unit [operator] declared in <root>' type=kotlin.Unit origin=MINUSEQ
$receiver: GET_VAR 'val result: <root>.Result [val] declared in <root>.box' type=<root>.Result origin=MINUSEQ
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
other: CALL 'public final fun minus (<this>: kotlin.Int, other: <root>.Result): <root>.Result [operator] declared in <root>' type=<root>.Result origin=MINUS
$receiver: CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CONST Int type=kotlin.Int value=1
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
other: CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CONST Int type=kotlin.Int value=0
CALL 'public final fun timesAssign (<this>: kotlin.Int, other: <root>.Result): kotlin.Unit [operator] declared in <root>' type=kotlin.Unit origin=MULTEQ
$receiver: GET_VAR 'val result: <root>.Result [val] declared in <root>.box' type=<root>.Result origin=MULTEQ
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
other: CALL 'public final fun times (<this>: kotlin.Int, other: <root>.Result): <root>.Result [operator] declared in <root>' type=<root>.Result origin=MUL
$receiver: CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CONST Int type=kotlin.Int value=1
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
other: CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CONST Int type=kotlin.Int value=2
CALL 'public final fun divAssign (<this>: kotlin.Int, other: <root>.Result): kotlin.Unit [operator] declared in <root>' type=kotlin.Unit origin=DIVEQ
$receiver: GET_VAR 'val result: <root>.Result [val] declared in <root>.box' type=<root>.Result origin=DIVEQ
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
other: CALL 'public final fun div (<this>: kotlin.Int, other: <root>.Result): <root>.Result [operator] declared in <root>' type=<root>.Result origin=DIV
$receiver: CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CONST Int type=kotlin.Int value=4
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
other: CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CONST Int type=kotlin.Int value=2
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
WHEN type=kotlin.String origin=IF
BRANCH
if: WHEN type=kotlin.Boolean origin=ANDAND
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'val result: <root>.Result [val] declared in <root>.box' type=<root>.Result origin=null
arg1: CONST Int type=kotlin.Int value=1
then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=GET_PROPERTY
arg1: CONST Int type=kotlin.Int value=8
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Boolean type=kotlin.Boolean value=false
then: CONST String type=kotlin.String value="OK"
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST String type=kotlin.String value="fail"
@@ -0,0 +1,67 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
data class Result(var i: Int)
var operationScore = 0
context(Int)
operator fun Result.plus(other: Result): Result {
operationScore += this@Int
return Result(i + other.i)
}
context(Int)
operator fun Result.plusAssign(other: Result) {
operationScore += this@Int
i += other.i
}
context(Int)
operator fun Result.minus(other: Result): Result {
operationScore += this@Int
return Result(i - other.i)
}
context(Int)
operator fun Result.minusAssign(other: Result) {
operationScore += this@Int
i -= other.i
}
context(Int)
operator fun Result.times(other: Result): Result {
operationScore += this@Int
return Result(i * other.i)
}
context(Int)
operator fun Result.timesAssign(other: Result) {
operationScore += this@Int
i *= other.i
}
context(Int)
operator fun Result.div(other: Result): Result {
operationScore += this@Int
return Result(i / other.i)
}
context(Int)
operator fun Result.divAssign(other: Result) {
operationScore += this@Int
i /= other.i
}
fun box(): String {
val result = Result(0)
with(1) {
result += (Result(1) + Result(1))
result -= (Result(1) - Result(0))
result *= (Result(1) * Result(2))
result /= (Result(4) / Result(2))
}
return if (result.i == 1 && operationScore == 8) "OK" else "fail"
}
@@ -0,0 +1,134 @@
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 toString(): String {
return "Result(" + "i=" + <this>.#i + ")"
}
override fun hashCode(): Int {
return <this>.#i.hashCode()
}
override operator 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
}
}
var operationScore: Int
field = 0
get
set
operator fun Result.plus(<this>: Int, other: Result): Result {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
return Result(i = <this>.<get-i>().plus(other = other.<get-i>()))
}
operator fun Result.plusAssign(<this>: Int, other: Result) {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
{ // BLOCK
val tmp0_this: Result = <this>
tmp0_this.<set-i>(<set-?> = tmp0_this.<get-i>().plus(other = other.<get-i>()))
}
}
operator fun Result.minus(<this>: Int, other: Result): Result {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
return Result(i = <this>.<get-i>().minus(other = other.<get-i>()))
}
operator fun Result.minusAssign(<this>: Int, other: Result) {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
{ // BLOCK
val tmp0_this: Result = <this>
tmp0_this.<set-i>(<set-?> = tmp0_this.<get-i>().minus(other = other.<get-i>()))
}
}
operator fun Result.times(<this>: Int, other: Result): Result {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
return Result(i = <this>.<get-i>().times(other = other.<get-i>()))
}
operator fun Result.timesAssign(<this>: Int, other: Result) {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
{ // BLOCK
val tmp0_this: Result = <this>
tmp0_this.<set-i>(<set-?> = tmp0_this.<get-i>().times(other = other.<get-i>()))
}
}
operator fun Result.div(<this>: Int, other: Result): Result {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
return Result(i = <this>.<get-i>().div(other = other.<get-i>()))
}
operator fun Result.divAssign(<this>: Int, other: Result) {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
{ // BLOCK
val tmp0_this: Result = <this>
tmp0_this.<set-i>(<set-?> = tmp0_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(<this> = $this$with, other = Result(i = 1).plus(<this> = $this$with, other = Result(i = 1)))
result.minusAssign(<this> = $this$with, other = Result(i = 1).minus(<this> = $this$with, other = Result(i = 0)))
result.timesAssign(<this> = $this$with, other = Result(i = 1).times(<this> = $this$with, other = Result(i = 2)))
result.divAssign(<this> = $this$with, other = Result(i = 4).div(<this> = $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"
}
}
@@ -0,0 +1,169 @@
FILE fqName:<root> fileName:/delegatedPropertiesOperators.kt
PROPERTY name:operationScore visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=0
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-operationScore> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:operationScore visibility:public modality:FINAL [var]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-operationScore> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]' type=kotlin.Int origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-operationScore> visibility:public modality:FINAL <> (<set-?>:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:operationScore visibility:public modality:FINAL [var]
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null
value: GET_VAR '<set-?>: kotlin.Int declared in <root>.<set-operationScore>' type=kotlin.Int origin=null
CLASS CLASS name:Delegate modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Delegate
CONSTRUCTOR visibility:public <> () returnType:<root>.Delegate [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Delegate modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:delegateValue visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:delegateValue type:kotlin.String visibility:private
EXPRESSION_BODY
CONST String type=kotlin.String value="fail"
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-delegateValue> visibility:public modality:FINAL <> ($this:<root>.Delegate) returnType:kotlin.String
correspondingProperty: PROPERTY name:delegateValue visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.Delegate
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-delegateValue> (): kotlin.String declared in <root>.Delegate'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:delegateValue type:kotlin.String visibility:private' type=kotlin.String origin=null
receiver: GET_VAR '<this>: <root>.Delegate declared in <root>.Delegate.<get-delegateValue>' type=<root>.Delegate origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-delegateValue> visibility:public modality:FINAL <> ($this:<root>.Delegate, <set-?>:kotlin.String) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:delegateValue visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.Delegate
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.String
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:delegateValue type:kotlin.String visibility:private' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Delegate declared in <root>.Delegate.<set-delegateValue>' type=<root>.Delegate origin=null
value: GET_VAR '<set-?>: kotlin.String declared in <root>.Delegate.<set-delegateValue>' type=kotlin.String origin=null
FUN name:getValue visibility:public modality:FINAL <> ($this:<root>.Delegate, <this>:kotlin.Int, thisRef:kotlin.Any?, property:kotlin.reflect.KProperty<*>) returnType:kotlin.String [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.Delegate
contextReceiverParametersCount: 1
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:thisRef index:1 type:kotlin.Any?
VALUE_PARAMETER name:property index:2 type:kotlin.reflect.KProperty<*>
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.Delegate.getValue' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun getValue (<this>: kotlin.Int, thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): kotlin.String [operator] declared in <root>.Delegate'
CALL 'public final fun <get-delegateValue> (): kotlin.String declared in <root>.Delegate' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Delegate declared in <root>.Delegate.getValue' type=<root>.Delegate origin=null
FUN name:setValue visibility:public modality:FINAL <> ($this:<root>.Delegate, <this>:kotlin.Int, thisRef:kotlin.Any?, property:kotlin.reflect.KProperty<*>, value:kotlin.String) returnType:kotlin.Unit [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.Delegate
contextReceiverParametersCount: 1
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
VALUE_PARAMETER name:thisRef index:1 type:kotlin.Any?
VALUE_PARAMETER name:property index:2 type:kotlin.reflect.KProperty<*>
VALUE_PARAMETER name:value index:3 type:kotlin.String
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.Delegate.setValue' type=kotlin.Int origin=null
CALL 'public final fun <set-delegateValue> (<set-?>: kotlin.String): kotlin.Unit declared in <root>.Delegate' type=kotlin.Unit origin=EQ
$this: GET_VAR '<this>: <root>.Delegate declared in <root>.Delegate.setValue' type=<root>.Delegate origin=null
<set-?>: GET_VAR 'value: kotlin.String declared in <root>.Delegate.setValue' type=kotlin.String origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS CLASS name:Result modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Result
FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:kotlin.Int visibility:private [final]
CONSTRUCTOR visibility:public <> (<this>:kotlin.Int) returnType:<root>.Result [primary]
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
SET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:kotlin.Int visibility:private [final]' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result' type=<root>.Result origin=null
value: GET_VAR '<this>: kotlin.Int declared in <root>.Result.<init>' type=kotlin.Int origin=null
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Result modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:s visibility:public modality:FINAL [delegated,var]
FIELD PROPERTY_DELEGATE name:s$delegate type:<root>.Delegate visibility:private [final]
EXPRESSION_BODY
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Delegate' type=<root>.Delegate origin=null
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-s> visibility:public modality:FINAL <> ($this:<root>.Result) returnType:kotlin.String
correspondingProperty: PROPERTY name:s visibility:public modality:FINAL [delegated,var]
$this: VALUE_PARAMETER name:<this> type:<root>.Result
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-s> (): kotlin.String declared in <root>.Result'
CALL 'public final fun getValue (<this>: kotlin.Int, thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): kotlin.String [operator] declared in <root>.Delegate' type=kotlin.String origin=null
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:s$delegate type:<root>.Delegate visibility:private [final]' type=<root>.Delegate origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.<get-s>' type=<root>.Result origin=null
<this>: GET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.<get-s>' type=<root>.Result origin=null
thisRef: GET_VAR '<this>: <root>.Result declared in <root>.Result.<get-s>' type=<root>.Result origin=null
property: PROPERTY_REFERENCE 'public final s: kotlin.String [delegated,var]' field=null getter='public final fun <get-s> (): kotlin.String declared in <root>.Result' setter='public final fun <set-s> (<set-?>: kotlin.String): kotlin.Unit declared in <root>.Result' type=kotlin.reflect.KMutableProperty1<<root>.Result, kotlin.String> origin=PROPERTY_REFERENCE_FOR_DELEGATE
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-s> visibility:public modality:FINAL <> ($this:<root>.Result, <set-?>:kotlin.String) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:s visibility:public modality:FINAL [delegated,var]
$this: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <set-s> (<set-?>: kotlin.String): kotlin.Unit declared in <root>.Result'
CALL 'public final fun setValue (<this>: kotlin.Int, thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>, value: kotlin.String): kotlin.Unit [operator] declared in <root>.Delegate' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:s$delegate type:<root>.Delegate visibility:private [final]' type=<root>.Delegate origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.<set-s>' type=<root>.Result origin=null
<this>: GET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.<set-s>' type=<root>.Result origin=null
thisRef: GET_VAR '<this>: <root>.Result declared in <root>.Result.<set-s>' type=<root>.Result origin=null
property: PROPERTY_REFERENCE 'public final s: kotlin.String [delegated,var]' field=null getter='public final fun <get-s> (): kotlin.String declared in <root>.Result' setter='public final fun <set-s> (<set-?>: kotlin.String): kotlin.Unit declared in <root>.Result' type=kotlin.reflect.KMutableProperty1<<root>.Result, kotlin.String> origin=PROPERTY_REFERENCE_FOR_DELEGATE
value: GET_VAR '<set-?>: kotlin.String declared in <root>.Result.<set-s>' type=kotlin.String origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
VAR name:result type:<root>.Result [val]
CALL 'public final fun with <T, R> (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1<T of kotlin.StandardKt.with, R of kotlin.StandardKt.with>): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=<root>.Result origin=null
<T>: kotlin.Int
<R>: <root>.Result
receiver: CONST Int type=kotlin.Int value=1
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<kotlin.Int, <root>.Result> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:kotlin.Int) returnType:<root>.Result
$receiver: VALUE_PARAMETER name:$this$with type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): <root>.Result declared in <root>.box'
CONSTRUCTOR_CALL 'public constructor <init> (<this>: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
CALL 'public final fun <set-s> (<set-?>: kotlin.String): kotlin.Unit declared in <root>.Result' type=kotlin.Unit origin=EQ
$this: GET_VAR 'val result: <root>.Result [val] declared in <root>.box' type=<root>.Result origin=null
<set-?>: CONST String type=kotlin.String value="OK"
VAR name:returnValue type:kotlin.String [val]
CALL 'public final fun <get-s> (): kotlin.String declared in <root>.Result' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR 'val result: <root>.Result [val] declared in <root>.box' type=<root>.Result origin=null
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
WHEN type=kotlin.String origin=IF
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=GET_PROPERTY
arg1: CONST Int type=kotlin.Int value=2
then: GET_VAR 'val returnValue: kotlin.String [val] declared in <root>.box' type=kotlin.String origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST String type=kotlin.String value="fail"
@@ -0,0 +1,36 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_STDLIB
import kotlin.reflect.KProperty
var operationScore = 0
class Delegate {
var delegateValue = "fail"
context(Int)
operator fun getValue(thisRef: Any?, property: KProperty<*>): String {
operationScore += this@Int
return delegateValue
}
context(Int)
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) {
operationScore += this@Int
delegateValue = value
}
}
context(Int)
class Result {
var s: String by Delegate()
}
fun box(): String {
val result = with(1) { Result() }
result.s = "OK"
val returnValue = result.s
return if (operationScore == 2) returnValue else "fail"
}
@@ -0,0 +1,65 @@
var operationScore: Int
field = 0
get
set
class Delegate {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
var delegateValue: String
field = "fail"
get
set
operator fun getValue(<this>: Int, thisRef: Any?, property: KProperty<*>): String {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
return <this>.<get-delegateValue>()
}
operator fun setValue(<this>: Int, thisRef: Any?, property: KProperty<*>, value: String) {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
<this>.<set-delegateValue>(<set-?> = value)
}
}
class Result {
private /* final field */ val contextReceiverField0: Int
constructor(<this>: Int) /* primary */ {
super/*Any*/()
<this>.#contextReceiverField0 = <this>
/* <init>() */
}
var s: String /* by */
field = Delegate()
get(): String {
return <this>.#s$delegate.getValue(<this> = <this>.#contextReceiverField0, thisRef = <this>, property = Result::s)
}
set(<set-?>: String) {
return <this>.#s$delegate.setValue(<this> = <this>.#contextReceiverField0, thisRef = <this>, property = Result::s, value = <set-?>)
}
}
fun box(): String {
val result: Result = with<Int, Result>(receiver = 1, block = local fun Int.<anonymous>(): Result {
return Result(<this> = $this$with)
}
)
result.<set-s>(<set-?> = "OK")
val returnValue: String = result.<get-s>()
return when {
EQEQ(arg0 = <get-operationScore>(), arg1 = 2) -> returnValue
else -> "fail"
}
}
@@ -0,0 +1,316 @@
FILE fqName:<root> fileName:/iteratorOperator.kt
CLASS CLASS name:Counter modality:FINAL visibility:public [data] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Counter
CONSTRUCTOR visibility:public <> (i:kotlin.Int) returnType:<root>.Counter [primary]
VALUE_PARAMETER name:i index:0 type:kotlin.Int
EXPRESSION_BODY
CONST Int type=kotlin.Int value=0
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Counter modality:FINAL visibility:public [data] superTypes:[kotlin.Any]'
PROPERTY name:i visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private
EXPRESSION_BODY
GET_VAR 'i: kotlin.Int declared in <root>.Counter.<init>' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-i> visibility:public modality:FINAL <> ($this:<root>.Counter) returnType:kotlin.Int
correspondingProperty: PROPERTY name:i visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.Counter
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-i> (): kotlin.Int declared in <root>.Counter'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Counter declared in <root>.Counter.<get-i>' type=<root>.Counter origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-i> visibility:public modality:FINAL <> ($this:<root>.Counter, <set-?>:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:i visibility:public modality:FINAL [var]
$this: VALUE_PARAMETER name:<this> type:<root>.Counter
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.Counter declared in <root>.Counter.<set-i>' type=<root>.Counter origin=null
value: GET_VAR '<set-?>: kotlin.Int declared in <root>.Counter.<set-i>' type=kotlin.Int origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:<root>.Counter) returnType:kotlin.Int [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.Counter
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int [operator] declared in <root>.Counter'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Counter declared in <root>.Counter.component1' type=<root>.Counter origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:<root>.Counter, i:kotlin.Int) returnType:<root>.Counter
$this: VALUE_PARAMETER name:<this> type:<root>.Counter
VALUE_PARAMETER name:i index:0 type:kotlin.Int
EXPRESSION_BODY
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Counter declared in <root>.Counter.copy' type=<root>.Counter origin=null
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun copy (i: kotlin.Int): <root>.Counter declared in <root>.Counter'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Counter' type=<root>.Counter origin=null
i: GET_VAR 'i: kotlin.Int declared in <root>.Counter.copy' type=kotlin.Int origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:<root>.Counter) returnType:kotlin.String
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.Counter
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.Counter'
STRING_CONCATENATION type=kotlin.String
CONST String type=kotlin.String value="Counter("
CONST String type=kotlin.String value="i="
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Counter declared in <root>.Counter.toString' type=<root>.Counter origin=null
CONST String type=kotlin.String value=")"
FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:<root>.Counter) returnType:kotlin.Int
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.Counter
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in <root>.Counter'
CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Counter declared in <root>.Counter.hashCode' type=<root>.Counter origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:<root>.Counter, other:kotlin.Any?) returnType:kotlin.Boolean [operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.Counter
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
BLOCK_BODY
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ
arg0: GET_VAR '<this>: <root>.Counter declared in <root>.Counter.equals' type=<root>.Counter origin=null
arg1: GET_VAR 'other: kotlin.Any? declared in <root>.Counter.equals' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Counter'
CONST Boolean type=kotlin.Boolean value=true
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=<root>.Counter
GET_VAR 'other: kotlin.Any? declared in <root>.Counter.equals' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Counter'
CONST Boolean type=kotlin.Boolean value=false
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.Counter [val]
TYPE_OP type=<root>.Counter origin=CAST typeOperand=<root>.Counter
GET_VAR 'other: kotlin.Any? declared in <root>.Counter.equals' type=kotlin.Any? origin=null
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Counter declared in <root>.Counter.equals' type=<root>.Counter origin=null
arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private' type=kotlin.Int origin=null
receiver: GET_VAR 'val tmp_0: <root>.Counter [val] declared in <root>.Counter.equals' type=<root>.Counter origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Counter'
CONST Boolean type=kotlin.Boolean value=false
RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Counter'
CONST Boolean type=kotlin.Boolean value=true
CLASS CLASS name:CounterConfig modality:FINAL visibility:public [data] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CounterConfig
CONSTRUCTOR visibility:public <> (max:kotlin.Int) returnType:<root>.CounterConfig [primary]
VALUE_PARAMETER name:max index:0 type:kotlin.Int
EXPRESSION_BODY
CONST Int type=kotlin.Int value=10
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:CounterConfig modality:FINAL visibility:public [data] superTypes:[kotlin.Any]'
PROPERTY name:max visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:max type:kotlin.Int visibility:private [final]
EXPRESSION_BODY
GET_VAR 'max: kotlin.Int declared in <root>.CounterConfig.<init>' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-max> visibility:public modality:FINAL <> ($this:<root>.CounterConfig) returnType:kotlin.Int
correspondingProperty: PROPERTY name:max visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.CounterConfig
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-max> (): kotlin.Int declared in <root>.CounterConfig'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:max type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.CounterConfig declared in <root>.CounterConfig.<get-max>' type=<root>.CounterConfig origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:<root>.CounterConfig) returnType:kotlin.Int [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.CounterConfig
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int [operator] declared in <root>.CounterConfig'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:max type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.CounterConfig declared in <root>.CounterConfig.component1' type=<root>.CounterConfig origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:<root>.CounterConfig, max:kotlin.Int) returnType:<root>.CounterConfig
$this: VALUE_PARAMETER name:<this> type:<root>.CounterConfig
VALUE_PARAMETER name:max index:0 type:kotlin.Int
EXPRESSION_BODY
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:max type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.CounterConfig declared in <root>.CounterConfig.copy' type=<root>.CounterConfig origin=null
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun copy (max: kotlin.Int): <root>.CounterConfig declared in <root>.CounterConfig'
CONSTRUCTOR_CALL 'public constructor <init> (max: kotlin.Int) [primary] declared in <root>.CounterConfig' type=<root>.CounterConfig origin=null
max: GET_VAR 'max: kotlin.Int declared in <root>.CounterConfig.copy' type=kotlin.Int origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:<root>.CounterConfig) returnType:kotlin.String
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.CounterConfig
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.CounterConfig'
STRING_CONCATENATION type=kotlin.String
CONST String type=kotlin.String value="CounterConfig("
CONST String type=kotlin.String value="max="
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:max type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.CounterConfig declared in <root>.CounterConfig.toString' type=<root>.CounterConfig origin=null
CONST String type=kotlin.String value=")"
FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:<root>.CounterConfig) returnType:kotlin.Int
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.CounterConfig
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in <root>.CounterConfig'
CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:max type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.CounterConfig declared in <root>.CounterConfig.hashCode' type=<root>.CounterConfig origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:<root>.CounterConfig, other:kotlin.Any?) returnType:kotlin.Boolean [operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.CounterConfig
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
BLOCK_BODY
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ
arg0: GET_VAR '<this>: <root>.CounterConfig declared in <root>.CounterConfig.equals' type=<root>.CounterConfig origin=null
arg1: GET_VAR 'other: kotlin.Any? declared in <root>.CounterConfig.equals' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.CounterConfig'
CONST Boolean type=kotlin.Boolean value=true
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=<root>.CounterConfig
GET_VAR 'other: kotlin.Any? declared in <root>.CounterConfig.equals' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.CounterConfig'
CONST Boolean type=kotlin.Boolean value=false
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:<root>.CounterConfig [val]
TYPE_OP type=<root>.CounterConfig origin=CAST typeOperand=<root>.CounterConfig
GET_VAR 'other: kotlin.Any? declared in <root>.CounterConfig.equals' type=kotlin.Any? origin=null
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:max type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.CounterConfig declared in <root>.CounterConfig.equals' type=<root>.CounterConfig origin=null
arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:max type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR 'val tmp_1: <root>.CounterConfig [val] declared in <root>.CounterConfig.equals' type=<root>.CounterConfig origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.CounterConfig'
CONST Boolean type=kotlin.Boolean value=false
RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.CounterConfig'
CONST Boolean type=kotlin.Boolean value=true
CLASS CLASS name:CounterIterator modality:FINAL visibility:public superTypes:[kotlin.collections.Iterator<kotlin.Int>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CounterIterator
FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:<root>.CounterConfig visibility:private [final]
CONSTRUCTOR visibility:public <> (<this>:<root>.CounterConfig, counter:<root>.Counter) returnType:<root>.CounterIterator [primary]
VALUE_PARAMETER name:<this> index:0 type:<root>.CounterConfig
VALUE_PARAMETER name:counter index:1 type:<root>.Counter
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
SET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:<root>.CounterConfig visibility:private [final]' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.CounterIterator declared in <root>.CounterIterator' type=<root>.CounterIterator origin=null
value: GET_VAR '<this>: <root>.CounterConfig declared in <root>.CounterIterator.<init>' type=<root>.CounterConfig origin=null
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:CounterIterator modality:FINAL visibility:public superTypes:[kotlin.collections.Iterator<kotlin.Int>]'
PROPERTY name:counter visibility:private modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:counter type:<root>.Counter visibility:private [final]
EXPRESSION_BODY
GET_VAR 'counter: <root>.Counter declared in <root>.CounterIterator.<init>' type=<root>.Counter origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-counter> visibility:private modality:FINAL <> ($this:<root>.CounterIterator) returnType:<root>.Counter
correspondingProperty: PROPERTY name:counter visibility:private modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.CounterIterator
BLOCK_BODY
RETURN type=kotlin.Nothing from='private final fun <get-counter> (): <root>.Counter declared in <root>.CounterIterator'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:<root>.Counter visibility:private [final]' type=<root>.Counter origin=null
receiver: GET_VAR '<this>: <root>.CounterIterator declared in <root>.CounterIterator.<get-counter>' type=<root>.CounterIterator origin=null
FUN name:hasNext visibility:public modality:OPEN <> ($this:<root>.CounterIterator) returnType:kotlin.Boolean [operator]
overridden:
public abstract fun hasNext (): kotlin.Boolean [operator] declared in kotlin.collections.Iterator
$this: VALUE_PARAMETER name:<this> type:<root>.CounterIterator
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun hasNext (): kotlin.Boolean [operator] declared in <root>.CounterIterator'
CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
arg0: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Counter' type=kotlin.Int origin=GET_PROPERTY
$this: CALL 'private final fun <get-counter> (): <root>.Counter declared in <root>.CounterIterator' type=<root>.Counter origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.CounterIterator declared in <root>.CounterIterator.hasNext' type=<root>.CounterIterator origin=null
arg1: CALL 'public final fun <get-max> (): kotlin.Int declared in <root>.CounterConfig' type=kotlin.Int origin=GET_PROPERTY
$this: GET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:<root>.CounterConfig visibility:private [final]' type=<root>.CounterConfig origin=null
receiver: GET_VAR '<this>: <root>.CounterIterator declared in <root>.CounterIterator.hasNext' type=<root>.CounterIterator origin=null
FUN name:next visibility:public modality:OPEN <> ($this:<root>.CounterIterator) returnType:kotlin.Int [operator]
overridden:
public abstract fun next (): T of kotlin.collections.Iterator [operator] declared in kotlin.collections.Iterator
$this: VALUE_PARAMETER name:<this> type:<root>.CounterIterator
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun next (): kotlin.Int [operator] declared in <root>.CounterIterator'
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:<root>.Counter [val]
CALL 'private final fun <get-counter> (): <root>.Counter declared in <root>.CounterIterator' type=<root>.Counter origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.CounterIterator declared in <root>.CounterIterator.next' type=<root>.CounterIterator origin=null
BLOCK type=kotlin.Int origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val]
CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Counter' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'val tmp_2: <root>.Counter [val] declared in <root>.CounterIterator.next' type=<root>.Counter origin=null
CALL 'public final fun <set-i> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.Counter' type=kotlin.Unit origin=POSTFIX_INCR
$this: GET_VAR 'val tmp_2: <root>.Counter [val] declared in <root>.CounterIterator.next' type=<root>.Counter origin=null
<set-?>: CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=POSTFIX_INCR
$this: GET_VAR 'val tmp_3: kotlin.Int [val] declared in <root>.CounterIterator.next' type=kotlin.Int origin=null
GET_VAR 'val tmp_3: kotlin.Int [val] declared in <root>.CounterIterator.next' type=kotlin.Int origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.Iterator
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.collections.Iterator
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String [fake_override] declared in kotlin.collections.Iterator
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:iterator visibility:public modality:FINAL <> ($receiver:<root>.Counter, <this>:<root>.CounterConfig) returnType:<root>.CounterIterator [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Counter
VALUE_PARAMETER name:<this> index:0 type:<root>.CounterConfig
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun iterator (<this>: <root>.CounterConfig): <root>.CounterIterator [operator] declared in <root>'
CALL 'public final fun with <T, R> (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1<T of kotlin.StandardKt.with, R of kotlin.StandardKt.with>): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=<root>.CounterIterator origin=null
<T>: <root>.CounterConfig
<R>: <root>.CounterIterator
receiver: GET_VAR '<this>: <root>.CounterConfig declared in <root>.iterator' type=<root>.CounterConfig origin=null
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<<root>.CounterConfig, <root>.CounterIterator> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.CounterConfig) returnType:<root>.CounterIterator
$receiver: VALUE_PARAMETER name:$this$with type:<root>.CounterConfig
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): <root>.CounterIterator declared in <root>.iterator'
CONSTRUCTOR_CALL 'public constructor <init> (<this>: <root>.CounterConfig, counter: <root>.Counter) [primary] declared in <root>.CounterIterator' type=<root>.CounterIterator origin=null
<this>: GET_VAR '$this$with: <root>.CounterConfig declared in <root>.iterator.<anonymous>' type=<root>.CounterConfig origin=null
counter: GET_VAR '<this>: <root>.Counter declared in <root>.iterator' type=<root>.Counter origin=null
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
VAR name:result type:kotlin.Int [var]
CONST Int type=kotlin.Int value=0
CALL 'public final fun with <T, R> (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1<T of kotlin.StandardKt.with, R of kotlin.StandardKt.with>): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null
<T>: <root>.CounterConfig
<R>: kotlin.Unit
receiver: CONSTRUCTOR_CALL 'public constructor <init> (max: kotlin.Int) [primary] declared in <root>.CounterConfig' type=<root>.CounterConfig origin=null
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<<root>.CounterConfig, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.CounterConfig) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:$this$with type:<root>.CounterConfig
BLOCK_BODY
BLOCK type=kotlin.Unit origin=FOR_LOOP
VAR FOR_LOOP_ITERATOR name:tmp_4 type:<root>.CounterIterator [val]
CALL 'public final fun iterator (<this>: <root>.CounterConfig): <root>.CounterIterator [operator] declared in <root>' type=<root>.CounterIterator origin=FOR_LOOP_ITERATOR
$receiver: CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Counter' type=<root>.Counter origin=null
<this>: GET_VAR '$this$with: <root>.CounterConfig declared in <root>.box.<anonymous>' type=<root>.CounterConfig origin=null
WHILE label=null origin=FOR_LOOP_INNER_WHILE
condition: CALL 'public open fun hasNext (): kotlin.Boolean [operator] declared in <root>.CounterIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT
$this: GET_VAR 'val tmp_4: <root>.CounterIterator [val] declared in <root>.box.<anonymous>' type=<root>.CounterIterator origin=null
body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE
VAR FOR_LOOP_VARIABLE name:i type:kotlin.Int [val]
CALL 'public open fun next (): kotlin.Int [operator] declared in <root>.CounterIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
$this: GET_VAR 'val tmp_4: <root>.CounterIterator [val] declared in <root>.box.<anonymous>' type=<root>.CounterIterator origin=null
BLOCK type=kotlin.Unit origin=null
SET_VAR 'var result: kotlin.Int [var] declared in <root>.box' type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: GET_VAR 'var result: kotlin.Int [var] declared in <root>.box' type=kotlin.Int origin=PLUSEQ
other: GET_VAR 'val i: kotlin.Int [val] declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
WHEN type=kotlin.String origin=IF
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'var result: kotlin.Int [var] declared in <root>.box' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=45
then: CONST String type=kotlin.String value="OK"
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST String type=kotlin.String value="fail"
@@ -0,0 +1,28 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_STDLIB
data class Counter(var i: Int = 0)
data class CounterConfig(val max: Int = 10)
context(CounterConfig)
class CounterIterator(private val counter: Counter) : Iterator<Int> {
override fun hasNext() = counter.i < max
override fun next() = counter.i++
}
context(CounterConfig)
operator fun Counter.iterator() = with(this@CounterConfig) { CounterIterator(this@Counter) }
fun box(): String {
var result = 0
with(CounterConfig()) {
for (i in Counter()) {
result += i
}
}
return if (result == 45) "OK" else "fail"
}
@@ -0,0 +1,143 @@
data class Counter {
constructor(i: Int = 0) /* primary */ {
super/*Any*/()
/* <init>() */
}
var i: Int
field = i
get
set
operator fun component1(): Int {
return <this>.#i
}
fun copy(i: Int = <this>.#i): Counter {
return Counter(i = i)
}
override fun toString(): String {
return "Counter(" + "i=" + <this>.#i + ")"
}
override fun hashCode(): Int {
return <this>.#i.hashCode()
}
override operator fun equals(other: Any?): Boolean {
when {
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
}
when {
other !is Counter -> return false
}
val tmp0_other_with_cast: Counter = other as Counter
when {
EQEQ(arg0 = <this>.#i, arg1 = tmp0_other_with_cast.#i).not() -> return false
}
return true
}
}
data class CounterConfig {
constructor(max: Int = 10) /* primary */ {
super/*Any*/()
/* <init>() */
}
val max: Int
field = max
get
operator fun component1(): Int {
return <this>.#max
}
fun copy(max: Int = <this>.#max): CounterConfig {
return CounterConfig(max = max)
}
override fun toString(): String {
return "CounterConfig(" + "max=" + <this>.#max + ")"
}
override fun hashCode(): Int {
return <this>.#max.hashCode()
}
override operator fun equals(other: Any?): Boolean {
when {
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
}
when {
other !is CounterConfig -> return false
}
val tmp0_other_with_cast: CounterConfig = other as CounterConfig
when {
EQEQ(arg0 = <this>.#max, arg1 = tmp0_other_with_cast.#max).not() -> return false
}
return true
}
}
class CounterIterator : Iterator<Int> {
private /* final field */ val contextReceiverField0: CounterConfig
constructor(<this>: CounterConfig, counter: Counter) /* primary */ {
super/*Any*/()
<this>.#contextReceiverField0 = <this>
/* <init>() */
}
private val counter: Counter
field = counter
private get
override operator fun hasNext(): Boolean {
return less(arg0 = <this>.<get-counter>().<get-i>(), arg1 = <this>.#contextReceiverField0.<get-max>())
}
override operator fun next(): Int {
return { // BLOCK
val tmp0_this: Counter = <this>.<get-counter>()
{ // BLOCK
val tmp1: Int = tmp0_this.<get-i>()
tmp0_this.<set-i>(<set-?> = tmp1.inc())
tmp1
}
}
}
}
operator fun Counter.iterator(<this>: CounterConfig): CounterIterator {
return with<CounterConfig, CounterIterator>(receiver = <this>, block = local fun CounterConfig.<anonymous>(): CounterIterator {
return CounterIterator(<this> = $this$with, counter = <this>)
}
)
}
fun box(): String {
var result: Int = 0
with<CounterConfig, Unit>(receiver = CounterConfig(), block = local fun CounterConfig.<anonymous>() {
{ // BLOCK
val tmp0_iterator: CounterIterator = Counter().iterator(<this> = $this$with)
while (tmp0_iterator.hasNext()) { // BLOCK
val i: Int = tmp0_iterator.next()
{ // BLOCK
result = result.plus(other = i)
}
}
}
}
)
return when {
EQEQ(arg0 = result, arg1 = 45) -> "OK"
else -> "fail"
}
}
@@ -0,0 +1,245 @@
FILE fqName:<root> fileName:/unaryOperators.kt
CLASS CLASS name:Result modality:FINAL visibility:public [data] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Result
CONSTRUCTOR visibility:public <> (i:kotlin.Int) returnType:<root>.Result [primary]
VALUE_PARAMETER name:i index:0 type:kotlin.Int
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Result modality:FINAL visibility:public [data] superTypes:[kotlin.Any]'
PROPERTY name:i visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private [final]
EXPRESSION_BODY
GET_VAR 'i: kotlin.Int declared in <root>.Result.<init>' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-i> visibility:public modality:FINAL <> ($this:<root>.Result) returnType:kotlin.Int
correspondingProperty: PROPERTY name:i visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.Result
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-i> (): kotlin.Int declared in <root>.Result'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.<get-i>' type=<root>.Result origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:<root>.Result) returnType:kotlin.Int [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.Result
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int [operator] declared in <root>.Result'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.component1' type=<root>.Result origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:<root>.Result, i:kotlin.Int) returnType:<root>.Result
$this: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:i index:0 type:kotlin.Int
EXPRESSION_BODY
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.copy' type=<root>.Result origin=null
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun copy (i: kotlin.Int): <root>.Result declared in <root>.Result'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: GET_VAR 'i: kotlin.Int declared in <root>.Result.copy' type=kotlin.Int origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:<root>.Result) returnType:kotlin.String
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.Result
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.Result'
STRING_CONCATENATION type=kotlin.String
CONST String type=kotlin.String value="Result("
CONST String type=kotlin.String value="i="
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.toString' type=<root>.Result origin=null
CONST String type=kotlin.String value=")"
FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:<root>.Result) returnType:kotlin.Int
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.Result
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in <root>.Result'
CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.hashCode' type=<root>.Result origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:<root>.Result, other:kotlin.Any?) returnType:kotlin.Boolean [operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
BLOCK_BODY
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ
arg0: GET_VAR '<this>: <root>.Result declared in <root>.Result.equals' type=<root>.Result origin=null
arg1: GET_VAR 'other: kotlin.Any? declared in <root>.Result.equals' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Result'
CONST Boolean type=kotlin.Boolean value=true
WHEN type=kotlin.Unit origin=null
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=<root>.Result
GET_VAR 'other: kotlin.Any? declared in <root>.Result.equals' type=kotlin.Any? origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Result'
CONST Boolean type=kotlin.Boolean value=false
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.Result [val]
TYPE_OP type=<root>.Result origin=CAST typeOperand=<root>.Result
GET_VAR 'other: kotlin.Any? declared in <root>.Result.equals' type=kotlin.Any? origin=null
WHEN type=kotlin.Unit origin=null
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Result declared in <root>.Result.equals' type=<root>.Result origin=null
arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:i type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR 'val tmp_0: <root>.Result [val] declared in <root>.Result.equals' type=<root>.Result origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Result'
CONST Boolean type=kotlin.Boolean value=false
RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Result'
CONST Boolean type=kotlin.Boolean value=true
PROPERTY name:operationScore visibility:public modality:FINAL [var]
FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=0
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-operationScore> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:operationScore visibility:public modality:FINAL [var]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-operationScore> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]' type=kotlin.Int origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-operationScore> visibility:public modality:FINAL <> (<set-?>:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:operationScore visibility:public modality:FINAL [var]
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:operationScore type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null
value: GET_VAR '<set-?>: kotlin.Int declared in <root>.<set-operationScore>' type=kotlin.Int origin=null
FUN name:unaryMinus visibility:public modality:FINAL <> ($receiver:<root>.Result, <this>:kotlin.Int) returnType:<root>.Result [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.unaryMinus' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun unaryMinus (<this>: kotlin.Int): <root>.Result [operator] declared in <root>'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CALL 'public final fun unaryMinus (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=UMINUS
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Result declared in <root>.unaryMinus' type=<root>.Result origin=null
FUN name:unaryPlus visibility:public modality:FINAL <> ($receiver:<root>.Result, <this>:kotlin.Int) returnType:<root>.Result [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.unaryPlus' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun unaryPlus (<this>: kotlin.Int): <root>.Result [operator] declared in <root>'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: WHEN type=kotlin.Int origin=IF
BRANCH
if: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
arg0: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Result declared in <root>.unaryPlus' type=<root>.Result origin=null
arg1: CONST Int type=kotlin.Int value=0
then: CALL 'public final fun unaryMinus (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=UMINUS
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Result declared in <root>.unaryPlus' type=<root>.Result origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Result declared in <root>.unaryPlus' type=<root>.Result origin=null
FUN name:inc visibility:public modality:FINAL <> ($receiver:<root>.Result, <this>:kotlin.Int) returnType:<root>.Result [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.inc' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun inc (<this>: kotlin.Int): <root>.Result [operator] declared in <root>'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Result declared in <root>.inc' type=<root>.Result origin=null
other: CONST Int type=kotlin.Int value=1
FUN name:dec visibility:public modality:FINAL <> ($receiver:<root>.Result, <this>:kotlin.Int) returnType:<root>.Result [operator]
contextReceiverParametersCount: 1
$receiver: VALUE_PARAMETER name:<this> type:<root>.Result
VALUE_PARAMETER name:<this> index:0 type:kotlin.Int
BLOCK_BODY
BLOCK type=kotlin.Unit origin=PLUSEQ
CALL 'public final fun <set-operationScore> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=PLUSEQ
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUSEQ
$this: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=PLUSEQ
other: GET_VAR '<this>: kotlin.Int declared in <root>.dec' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='public final fun dec (<this>: kotlin.Int): <root>.Result [operator] declared in <root>'
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CALL 'public final fun minus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MINUS
$this: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Result declared in <root>.dec' type=<root>.Result origin=null
other: CONST Int type=kotlin.Int value=1
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
VAR name:result type:<root>.Result [var]
CONSTRUCTOR_CALL 'public constructor <init> (i: kotlin.Int) [primary] declared in <root>.Result' type=<root>.Result origin=null
i: CONST Int type=kotlin.Int value=0
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun with <T, R> (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1<T of kotlin.StandardKt.with, R of kotlin.StandardKt.with>): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=<root>.Result origin=null
<T>: kotlin.Int
<R>: <root>.Result
receiver: CONST Int type=kotlin.Int value=1
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<kotlin.Int, <root>.Result> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:kotlin.Int) returnType:<root>.Result
$receiver: VALUE_PARAMETER name:$this$with type:kotlin.Int
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=<root>.Result origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:<root>.Result [val]
GET_VAR 'var result: <root>.Result [var] declared in <root>.box' type=<root>.Result origin=POSTFIX_INCR
SET_VAR 'var result: <root>.Result [var] declared in <root>.box' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (<this>: kotlin.Int): <root>.Result [operator] declared in <root>' type=<root>.Result origin=POSTFIX_INCR
$receiver: GET_VAR 'val tmp_1: <root>.Result [val] declared in <root>.box.<anonymous>' type=<root>.Result origin=null
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
GET_VAR 'val tmp_1: <root>.Result [val] declared in <root>.box.<anonymous>' type=<root>.Result origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
BLOCK type=<root>.Result origin=POSTFIX_INCR
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:<root>.Result [val]
GET_VAR 'var result: <root>.Result [var] declared in <root>.box' type=<root>.Result origin=POSTFIX_INCR
SET_VAR 'var result: <root>.Result [var] declared in <root>.box' type=kotlin.Unit origin=POSTFIX_INCR
CALL 'public final fun inc (<this>: kotlin.Int): <root>.Result [operator] declared in <root>' type=<root>.Result origin=POSTFIX_INCR
$receiver: GET_VAR 'val tmp_2: <root>.Result [val] declared in <root>.box.<anonymous>' type=<root>.Result origin=null
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
GET_VAR 'val tmp_2: <root>.Result [val] declared in <root>.box.<anonymous>' type=<root>.Result origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun unaryMinus (<this>: kotlin.Int): <root>.Result [operator] declared in <root>' type=<root>.Result origin=UMINUS
$receiver: GET_VAR 'var result: <root>.Result [var] declared in <root>.box' type=<root>.Result origin=null
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun unaryPlus (<this>: kotlin.Int): <root>.Result [operator] declared in <root>' type=<root>.Result origin=UPLUS
$receiver: GET_VAR 'var result: <root>.Result [var] declared in <root>.box' type=<root>.Result origin=null
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): <root>.Result declared in <root>.box'
BLOCK type=<root>.Result origin=POSTFIX_DECR
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:<root>.Result [val]
GET_VAR 'var result: <root>.Result [var] declared in <root>.box' type=<root>.Result origin=POSTFIX_DECR
SET_VAR 'var result: <root>.Result [var] declared in <root>.box' type=kotlin.Unit origin=POSTFIX_DECR
CALL 'public final fun dec (<this>: kotlin.Int): <root>.Result [operator] declared in <root>' type=<root>.Result origin=POSTFIX_DECR
$receiver: GET_VAR 'val tmp_3: <root>.Result [val] declared in <root>.box.<anonymous>' type=<root>.Result origin=null
<this>: GET_VAR '$this$with: kotlin.Int declared in <root>.box.<anonymous>' type=kotlin.Int origin=null
GET_VAR 'val tmp_3: <root>.Result [val] declared in <root>.box.<anonymous>' type=<root>.Result origin=null
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
WHEN type=kotlin.String origin=IF
BRANCH
if: WHEN type=kotlin.Boolean origin=ANDAND
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: CALL 'public final fun <get-i> (): kotlin.Int declared in <root>.Result' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'var result: <root>.Result [var] declared in <root>.box' type=<root>.Result origin=null
arg1: CONST Int type=kotlin.Int value=1
then: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: CALL 'public final fun <get-operationScore> (): kotlin.Int declared in <root>' type=kotlin.Int origin=GET_PROPERTY
arg1: CONST Int type=kotlin.Int value=5
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Boolean type=kotlin.Boolean value=false
then: CONST String type=kotlin.String value="OK"
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST String type=kotlin.String value="fail"
@@ -0,0 +1,45 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
data class Result(val i: Int)
var operationScore = 0
context(Int)
operator fun Result.unaryMinus(): Result {
operationScore += this@Int
return Result(-i)
}
context(Int)
operator fun Result.unaryPlus(): Result {
operationScore += this@Int
return Result(if (i < 0) (-i) else i)
}
context(Int)
operator fun Result.inc(): Result {
operationScore += this@Int
return Result(i + 1)
}
context(Int)
operator fun Result.dec(): Result {
operationScore += this@Int
return Result(i - 1)
}
fun box(): String {
var result = Result(0)
with(1) {
result++
result++
(-result)
+result
result--
}
return if (result.i == 1 && operationScore == 5) "OK" else "fail"
}
@@ -0,0 +1,109 @@
data class Result {
constructor(i: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
val i: Int
field = i
get
operator fun component1(): Int {
return <this>.#i
}
fun copy(i: Int = <this>.#i): Result {
return Result(i = i)
}
override fun toString(): String {
return "Result(" + "i=" + <this>.#i + ")"
}
override fun hashCode(): Int {
return <this>.#i.hashCode()
}
override operator 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
}
}
var operationScore: Int
field = 0
get
set
operator fun Result.unaryMinus(<this>: Int): Result {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
return Result(i = <this>.<get-i>().unaryMinus())
}
operator fun Result.unaryPlus(<this>: Int): Result {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
return Result(i = when {
less(arg0 = <this>.<get-i>(), arg1 = 0) -> <this>.<get-i>().unaryMinus()
else -> <this>.<get-i>()
})
}
operator fun Result.inc(<this>: Int): Result {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
return Result(i = <this>.<get-i>().plus(other = 1))
}
operator fun Result.dec(<this>: Int): Result {
{ // BLOCK
<set-operationScore>(<set-?> = <get-operationScore>().plus(other = <this>))
}
return Result(i = <this>.<get-i>().minus(other = 1))
}
fun box(): String {
var result: Result = Result(i = 0)
with<Int, Result>(receiver = 1, block = local fun Int.<anonymous>(): Result {
{ // BLOCK
val tmp0: Result = result
result = tmp0.inc(<this> = $this$with)
tmp0
} /*~> Unit */
{ // BLOCK
val tmp1: Result = result
result = tmp1.inc(<this> = $this$with)
tmp1
} /*~> Unit */
result.unaryMinus(<this> = $this$with) /*~> Unit */
result.unaryPlus(<this> = $this$with) /*~> Unit */
return { // BLOCK
val tmp2: Result = result
result = tmp2.dec(<this> = $this$with)
tmp2
}
}
) /*~> Unit */
return when {
when {
EQEQ(arg0 = result.<get-i>(), arg1 = 1) -> EQEQ(arg0 = <get-operationScore>(), arg1 = 5)
else -> false
} -> "OK"
else -> "fail"
}
}