[PSI2IR] Fix parameter initialization for constructors with CR

This commit is contained in:
Anastasiya Shadrina
2021-10-29 05:19:14 +07:00
committed by TeamCityServer
parent 4caf42804a
commit 2fbfee3e11
20 changed files with 232 additions and 286 deletions
@@ -15946,6 +15946,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/extensionClasses/constructors.kt");
}
@Test
@TestMetadata("contextualPrimaryConstructorWithParams.kt")
public void testContextualPrimaryConstructorWithParams() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/contextualPrimaryConstructorWithParams.kt");
}
@Test
@TestMetadata("edouble.kt")
public void testEdouble() throws Exception {
@@ -757,6 +757,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
runTest("compiler/testData/ir/irText/declarations/contextReceivers/class.kt");
}
@Test
@TestMetadata("contextualPrimaryConstructorWithParams.kt")
public void testContextualPrimaryConstructorWithParams() throws Exception {
runTest("compiler/testData/ir/irText/declarations/contextReceivers/contextualPrimaryConstructorWithParams.kt");
}
@Test
@TestMetadata("function.kt")
public void testFunction() throws Exception {
@@ -474,7 +474,7 @@ class ClassGenerator(
}
ktPrimaryConstructor.valueParameters.forEachIndexed { i, ktParameter ->
val irValueParameter = irPrimaryConstructor.valueParameters[i]
val irValueParameter = irPrimaryConstructor.valueParameters[i + ktClassOrObject.contextReceivers.size]
if (ktParameter.hasValOrVar()) {
val irProperty = PropertyGenerator(declarationGenerator)
.generatePropertyForPrimaryConstructorParameter(ktParameter, irValueParameter)
@@ -156,7 +156,8 @@ internal class InsertImplicitCasts(
return expression.transformPostfix {
transformReceiverArguments(substitutedDescriptor)
for (index in substitutedDescriptor.valueParameters.indices) {
val argument = getValueArgument(index) ?: continue
val irIndex = index + substitutedDescriptor.contextReceiverParameters.size
val argument = getValueArgument(irIndex) ?: continue
val parameterType = substitutedDescriptor.valueParameters[index].type
val originalParameterType = substitutedDescriptor.original.valueParameters[index].type
@@ -168,7 +169,7 @@ internal class InsertImplicitCasts(
else
parameterType
putValueArgument(index, argument.cast(expectedType, originalExpectedType = originalParameterType))
putValueArgument(irIndex, argument.cast(expectedType, originalExpectedType = originalParameterType))
}
}
}
@@ -0,0 +1,17 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
class O(val o: String)
context(O)
class OK(val k: String) {
val result: String = o + k
}
fun box(): String {
return with(O("O")) {
val ok = OK("K")
ok.result
}
}
@@ -0,0 +1,103 @@
FILE fqName:<root> fileName:/contextualPrimaryConstructorWithParams.kt
CLASS CLASS name:O modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.O
CONSTRUCTOR visibility:public <> (o:kotlin.String) returnType:<root>.O [primary]
VALUE_PARAMETER name:o 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:O modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:o visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:o type:kotlin.String visibility:private [final]
EXPRESSION_BODY
GET_VAR 'o: kotlin.String declared in <root>.O.<init>' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-o> visibility:public modality:FINAL <> ($this:<root>.O) returnType:kotlin.String
correspondingProperty: PROPERTY name:o visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.O
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-o> (): kotlin.String declared in <root>.O'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:o type:kotlin.String visibility:private [final]' type=kotlin.String origin=null
receiver: GET_VAR '<this>: <root>.O declared in <root>.O.<get-o>' type=<root>.O 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:OK modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.OK
FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:<root>.O visibility:private [final]
CONSTRUCTOR visibility:public <> (<this>:<root>.O, k:kotlin.String) returnType:<root>.OK [primary]
VALUE_PARAMETER name:<this> index:0 type:<root>.O
VALUE_PARAMETER name:k index:1 type:kotlin.String
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>.O visibility:private [final]' type=kotlin.Unit origin=null
receiver: GET_VAR '<this>: <root>.OK declared in <root>.OK' type=<root>.OK origin=null
value: GET_VAR '<this>: <root>.O declared in <root>.OK.<init>' type=<root>.O origin=null
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:OK modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:k visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:k type:kotlin.String visibility:private [final]
EXPRESSION_BODY
GET_VAR 'k: kotlin.String declared in <root>.OK.<init>' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-k> visibility:public modality:FINAL <> ($this:<root>.OK) returnType:kotlin.String
correspondingProperty: PROPERTY name:k visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.OK
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-k> (): kotlin.String declared in <root>.OK'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:k type:kotlin.String visibility:private [final]' type=kotlin.String origin=null
receiver: GET_VAR '<this>: <root>.OK declared in <root>.OK.<get-k>' type=<root>.OK origin=null
PROPERTY name:result visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:result type:kotlin.String visibility:private [final]
EXPRESSION_BODY
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS
$this: CALL 'public final fun <get-o> (): kotlin.String declared in <root>.O' type=kotlin.String origin=GET_PROPERTY
$this: GET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:<root>.O visibility:private [final]' type=<root>.O origin=null
receiver: GET_VAR '<this>: <root>.OK declared in <root>.OK' type=<root>.OK origin=null
other: CALL 'public final fun <get-k> (): kotlin.String declared in <root>.OK' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.OK declared in <root>.OK' type=<root>.OK origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-result> visibility:public modality:FINAL <> ($this:<root>.OK) returnType:kotlin.String
correspondingProperty: PROPERTY name:result visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.OK
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-result> (): kotlin.String declared in <root>.OK'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:result type:kotlin.String visibility:private [final]' type=kotlin.String origin=null
receiver: GET_VAR '<this>: <root>.OK declared in <root>.OK.<get-result>' type=<root>.OK 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
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>: <root>.O
<R>: kotlin.String
receiver: CONSTRUCTOR_CALL 'public constructor <init> (o: kotlin.String) [primary] declared in <root>.O' type=<root>.O origin=null
o: CONST String type=kotlin.String value="O"
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<<root>.O, kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.O) returnType:kotlin.String
$receiver: VALUE_PARAMETER name:$this$with type:<root>.O
BLOCK_BODY
VAR name:ok type:<root>.OK [val]
CONSTRUCTOR_CALL 'public constructor <init> (<this>: <root>.O, k: kotlin.String) [primary] declared in <root>.OK' type=<root>.OK origin=null
<this>: GET_VAR '$this$with: <root>.O declared in <root>.box.<anonymous>' type=<root>.O origin=null
k: CONST String type=kotlin.String value="K"
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.box'
CALL 'public final fun <get-result> (): kotlin.String declared in <root>.OK' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR 'val ok: <root>.OK [val] declared in <root>.box.<anonymous>' type=<root>.OK origin=null
@@ -0,0 +1,16 @@
// !LANGUAGE: +ContextReceivers
// IGNORE_BACKEND_FIR: JVM_IR
class O(val o: String)
context(O)
class OK(val k: String) {
val result: String = o + k
}
fun box(): String {
return with(O("O")) {
val ok = OK("K")
ok.result
}
}
@@ -0,0 +1,39 @@
class O {
constructor(o: String) /* primary */ {
super/*Any*/()
/* <init>() */
}
val o: String
field = o
get
}
class OK {
private /* final field */ val contextReceiverField0: O
constructor(<this>: O, k: String) /* primary */ {
super/*Any*/()
<this>.#contextReceiverField0 = <this>
/* <init>() */
}
val k: String
field = k
get
val result: String
field = <this>.#contextReceiverField0.<get-o>().plus(other = <this>.<get-k>())
get
}
fun box(): String {
return with<O, String>(receiver = O(o = "O"), block = local fun O.<anonymous>(): String {
val ok: OK = OK(<this> = $this$with, k = "K")
return ok.<get-result>()
}
)
}
@@ -183,8 +183,7 @@ FILE fqName:<root> fileName:/compareTo.kt
<T>: T of <root>.<get-min>
$receiver: CALL 'public final fun <get-first> (): A of <root>.Pair declared in <root>.Pair' type=T of <root>.<get-min> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>> declared in <root>.<get-min>' type=<root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>> origin=null
<this>: TYPE_OP type=T of <root>.<get-min> origin=IMPLICIT_CAST typeOperand=T of <root>.<get-min>
GET_VAR '<this>: java.util.Comparator<T of <root>.<get-min>>{ kotlin.TypeAliasesKt.Comparator<T of <root>.<get-min>> } declared in <root>.<get-min>' type=java.util.Comparator<T of <root>.<get-min>>{ kotlin.TypeAliasesKt.Comparator<T of <root>.<get-min>> } origin=null
<this>: GET_VAR '<this>: java.util.Comparator<T of <root>.<get-min>>{ kotlin.TypeAliasesKt.Comparator<T of <root>.<get-min>> } declared in <root>.<get-min>' type=java.util.Comparator<T of <root>.<get-min>>{ kotlin.TypeAliasesKt.Comparator<T of <root>.<get-min>> } origin=null
other: CALL 'public final fun <get-second> (): B of <root>.Pair declared in <root>.Pair' type=T of <root>.<get-min> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>> declared in <root>.<get-min>' type=<root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>> origin=null
arg1: CONST Int type=kotlin.Int value=0
@@ -67,7 +67,7 @@ infix operator fun <T : Any?> T.compareTo(<this>: Comparator<T>, other: T): Int
val <T : Any?> Pair<T, T>.min: T
get(<this>: Comparator<T>): T {
return when {
less(arg0 = <this>.<get-first>().compareTo<T>(<this> = <this> /*as T */, other = <this>.<get-second>()), arg1 = 0) -> <this>.<get-first>()
less(arg0 = <this>.<get-first>().compareTo<T>(<this> = <this>, other = <this>.<get-second>()), arg1 = 0) -> <this>.<get-first>()
else -> <this>.<get-second>()
}
}
@@ -1,247 +0,0 @@
FILE fqName:<root> fileName:/compareTo.kt
CLASS CLASS name:Pair modality:FINAL visibility:public [data] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Pair<A of <root>.Pair, B of <root>.Pair>
TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?]
TYPE_PARAMETER name:B index:1 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (first:A of <root>.Pair, second:B of <root>.Pair) returnType:<root>.Pair<A of <root>.Pair, B of <root>.Pair> [primary]
VALUE_PARAMETER name:first index:0 type:A of <root>.Pair
VALUE_PARAMETER name:second index:1 type:B of <root>.Pair
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Pair modality:FINAL visibility:public [data] superTypes:[kotlin.Any]'
PROPERTY name:first visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:first type:A of <root>.Pair visibility:private [final]
EXPRESSION_BODY
GET_VAR 'first: A of <root>.Pair declared in <root>.Pair.<init>' type=A of <root>.Pair origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-first> visibility:public modality:FINAL <> ($this:<root>.Pair<A of <root>.Pair, B of <root>.Pair>) returnType:A of <root>.Pair
correspondingProperty: PROPERTY name:first visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.Pair<A of <root>.Pair, B of <root>.Pair>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-first> (): A of <root>.Pair declared in <root>.Pair'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:first type:A of <root>.Pair visibility:private [final]' type=A of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.<get-first>' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
PROPERTY name:second visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:second type:B of <root>.Pair visibility:private [final]
EXPRESSION_BODY
GET_VAR 'second: B of <root>.Pair declared in <root>.Pair.<init>' type=B of <root>.Pair origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-second> visibility:public modality:FINAL <> ($this:<root>.Pair<A of <root>.Pair, B of <root>.Pair>) returnType:B of <root>.Pair
correspondingProperty: PROPERTY name:second visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.Pair<A of <root>.Pair, B of <root>.Pair>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-second> (): B of <root>.Pair declared in <root>.Pair'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:second type:B of <root>.Pair visibility:private [final]' type=B of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.<get-second>' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:<root>.Pair<A of <root>.Pair, B of <root>.Pair>) returnType:A of <root>.Pair [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.Pair<A of <root>.Pair, B of <root>.Pair>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun component1 (): A of <root>.Pair [operator] declared in <root>.Pair'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:first type:A of <root>.Pair visibility:private [final]' type=A of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.component1' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:component2 visibility:public modality:FINAL <> ($this:<root>.Pair<A of <root>.Pair, B of <root>.Pair>) returnType:B of <root>.Pair [operator]
$this: VALUE_PARAMETER name:<this> type:<root>.Pair<A of <root>.Pair, B of <root>.Pair>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun component2 (): B of <root>.Pair [operator] declared in <root>.Pair'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:second type:B of <root>.Pair visibility:private [final]' type=B of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.component2' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:<root>.Pair<A of <root>.Pair, B of <root>.Pair>, first:A of <root>.Pair, second:B of <root>.Pair) returnType:<root>.Pair<A of <root>.Pair, B of <root>.Pair>
$this: VALUE_PARAMETER name:<this> type:<root>.Pair<A of <root>.Pair, B of <root>.Pair>
VALUE_PARAMETER name:first index:0 type:A of <root>.Pair
EXPRESSION_BODY
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:first type:A of <root>.Pair visibility:private [final]' type=A of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.copy' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
VALUE_PARAMETER name:second index:1 type:B of <root>.Pair
EXPRESSION_BODY
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:second type:B of <root>.Pair visibility:private [final]' type=B of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.copy' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun copy (first: A of <root>.Pair, second: B of <root>.Pair): <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair'
CONSTRUCTOR_CALL 'public constructor <init> (first: A of <root>.Pair, second: B of <root>.Pair) [primary] declared in <root>.Pair' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
<class: A>: A of <root>.Pair
<class: B>: B of <root>.Pair
first: GET_VAR 'first: A of <root>.Pair declared in <root>.Pair.copy' type=A of <root>.Pair origin=null
second: GET_VAR 'second: B of <root>.Pair declared in <root>.Pair.copy' type=B of <root>.Pair origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:<root>.Pair<A of <root>.Pair, B of <root>.Pair>) returnType:kotlin.String
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.Pair<A of <root>.Pair, B of <root>.Pair>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in <root>.Pair'
STRING_CONCATENATION type=kotlin.String
CONST String type=kotlin.String value="Pair("
CONST String type=kotlin.String value="first="
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:first type:A of <root>.Pair visibility:private [final]' type=A of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.toString' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
CONST String type=kotlin.String value=", "
CONST String type=kotlin.String value="second="
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:second type:B of <root>.Pair visibility:private [final]' type=B of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.toString' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
CONST String type=kotlin.String value=")"
FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:<root>.Pair<A of <root>.Pair, B of <root>.Pair>) returnType:kotlin.Int
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:<root>.Pair<A of <root>.Pair, B of <root>.Pair>
BLOCK_BODY
VAR name:result type:kotlin.Int [var]
WHEN type=kotlin.Int 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_FIELD 'FIELD PROPERTY_BACKING_FIELD name:first type:A of <root>.Pair visibility:private [final]' type=A of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.hashCode' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Int type=kotlin.Int value=0
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:first type:A of <root>.Pair visibility:private [final]' type=A of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.hashCode' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
SET_VAR 'var result: kotlin.Int [var] declared in <root>.Pair.hashCode' type=kotlin.Unit origin=EQ
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: GET_VAR 'var result: kotlin.Int [var] declared in <root>.Pair.hashCode' type=kotlin.Int origin=null
other: CONST Int type=kotlin.Int value=31
other: WHEN type=kotlin.Int 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_FIELD 'FIELD PROPERTY_BACKING_FIELD name:second type:B of <root>.Pair visibility:private [final]' type=B of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.hashCode' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Int type=kotlin.Int value=0
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:second type:B of <root>.Pair visibility:private [final]' type=B of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.hashCode' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in <root>.Pair'
GET_VAR 'var result: kotlin.Int [var] declared in <root>.Pair.hashCode' type=kotlin.Int origin=null
FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:<root>.Pair<A of <root>.Pair, B of <root>.Pair>, 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>.Pair<A of <root>.Pair, B of <root>.Pair>
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>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.equals' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
arg1: GET_VAR 'other: kotlin.Any? declared in <root>.Pair.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>.Pair'
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>.Pair<A of <root>.Pair, B of <root>.Pair>
GET_VAR 'other: kotlin.Any? declared in <root>.Pair.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>.Pair'
CONST Boolean type=kotlin.Boolean value=false
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.Pair<A of <root>.Pair, B of <root>.Pair> [val]
TYPE_OP type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=CAST typeOperand=<root>.Pair<A of <root>.Pair, B of <root>.Pair>
GET_VAR 'other: kotlin.Any? declared in <root>.Pair.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:first type:A of <root>.Pair visibility:private [final]' type=A of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.equals' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:first type:A of <root>.Pair visibility:private [final]' type=A of <root>.Pair origin=null
receiver: GET_VAR 'val tmp_0: <root>.Pair<A of <root>.Pair, B of <root>.Pair> [val] declared in <root>.Pair.equals' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Pair'
CONST Boolean type=kotlin.Boolean value=false
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:second type:B of <root>.Pair visibility:private [final]' type=B of <root>.Pair origin=null
receiver: GET_VAR '<this>: <root>.Pair<A of <root>.Pair, B of <root>.Pair> declared in <root>.Pair.equals' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:second type:B of <root>.Pair visibility:private [final]' type=B of <root>.Pair origin=null
receiver: GET_VAR 'val tmp_0: <root>.Pair<A of <root>.Pair, B of <root>.Pair> [val] declared in <root>.Pair.equals' type=<root>.Pair<A of <root>.Pair, B of <root>.Pair> origin=null
then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in <root>.Pair'
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>.Pair'
CONST Boolean type=kotlin.Boolean value=true
FUN name:compareTo visibility:public modality:FINAL <T> ($receiver:T of <root>.compareTo, <this>:java.util.Comparator<T of <root>.compareTo>{ kotlin.TypeAliasesKt.Comparator<T of <root>.compareTo> }, other:T of <root>.compareTo) returnType:kotlin.Int [operator,infix]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
$receiver: VALUE_PARAMETER name:<this> type:T of <root>.compareTo
VALUE_PARAMETER name:<this> index:0 type:java.util.Comparator<T of <root>.compareTo>{ kotlin.TypeAliasesKt.Comparator<T of <root>.compareTo> }
VALUE_PARAMETER name:other index:1 type:T of <root>.compareTo
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun compareTo <T> (<this>: java.util.Comparator<T of <root>.compareTo>{ kotlin.TypeAliasesKt.Comparator<T of <root>.compareTo> }, other: T of <root>.compareTo): kotlin.Int [operator,infix] declared in <root>'
CALL 'public abstract fun compare (p0: @[FlexibleNullability] T of java.util.Comparator?, p1: @[FlexibleNullability] T of java.util.Comparator?): kotlin.Int declared in java.util.Comparator' type=kotlin.Int origin=null
$this: GET_VAR '<this>: java.util.Comparator<T of <root>.compareTo>{ kotlin.TypeAliasesKt.Comparator<T of <root>.compareTo> } declared in <root>.compareTo' type=java.util.Comparator<T of <root>.compareTo>{ kotlin.TypeAliasesKt.Comparator<T of <root>.compareTo> } origin=null
p0: GET_VAR '<this>: T of <root>.compareTo declared in <root>.compareTo' type=T of <root>.compareTo origin=null
p1: GET_VAR 'other: T of <root>.compareTo declared in <root>.compareTo' type=T of <root>.compareTo origin=null
PROPERTY name:min visibility:public modality:FINAL [val]
FUN name:<get-min> visibility:public modality:FINAL <T> ($receiver:<root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>>, <this>:java.util.Comparator<T of <root>.<get-min>>{ kotlin.TypeAliasesKt.Comparator<T of <root>.<get-min>> }) returnType:T of <root>.<get-min>
correspondingProperty: PROPERTY name:min visibility:public modality:FINAL [val]
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
$receiver: VALUE_PARAMETER name:<this> type:<root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>>
VALUE_PARAMETER name:<this> index:0 type:java.util.Comparator<T of <root>.<get-min>>{ kotlin.TypeAliasesKt.Comparator<T of <root>.<get-min>> }
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-min> <T> (<this>: java.util.Comparator<T of <root>.<get-min>>{ kotlin.TypeAliasesKt.Comparator<T of <root>.<get-min>> }): T of <root>.<get-min> declared in <root>'
WHEN type=T of <root>.<get-min> 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 compareTo <T> (<this>: java.util.Comparator<T of <root>.compareTo>{ kotlin.TypeAliasesKt.Comparator<T of <root>.compareTo> }, other: T of <root>.compareTo): kotlin.Int [operator,infix] declared in <root>' type=kotlin.Int origin=LT
<T>: T of <root>.<get-min>
$receiver: CALL 'public final fun <get-first> (): A of <root>.Pair declared in <root>.Pair' type=T of <root>.<get-min> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>> declared in <root>.<get-min>' type=<root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>> origin=null
<this>: TYPE_OP type=T of <root>.<get-min> origin=IMPLICIT_CAST typeOperand=T of <root>.<get-min>
GET_VAR '<this>: java.util.Comparator<T of <root>.<get-min>>{ kotlin.TypeAliasesKt.Comparator<T of <root>.<get-min>> } declared in <root>.<get-min>' type=java.util.Comparator<T of <root>.<get-min>>{ kotlin.TypeAliasesKt.Comparator<T of <root>.<get-min>> } origin=null
other: CALL 'public final fun <get-second> (): B of <root>.Pair declared in <root>.Pair' type=T of <root>.<get-min> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>> declared in <root>.<get-min>' type=<root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>> origin=null
arg1: CONST Int type=kotlin.Int value=0
then: CALL 'public final fun <get-first> (): A of <root>.Pair declared in <root>.Pair' type=T of <root>.<get-min> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>> declared in <root>.<get-min>' type=<root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>> origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public final fun <get-second> (): B of <root>.Pair declared in <root>.Pair' type=T of <root>.<get-min> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>> declared in <root>.<get-min>' type=<root>.Pair<T of <root>.<get-min>, T of <root>.<get-min>> origin=null
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
VAR name:comparator type:java.util.Comparator<kotlin.String> [val]
TYPE_OP type=java.util.Comparator<kotlin.String> origin=SAM_CONVERSION typeOperand=java.util.Comparator<kotlin.String>
FUN_EXPR type=kotlin.Function2<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?, kotlin.Int> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (a:@[FlexibleNullability] kotlin.String?, b:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Int
VALUE_PARAMETER name:a index:0 type:@[FlexibleNullability] kotlin.String?
VALUE_PARAMETER name:b index:1 type:@[FlexibleNullability] kotlin.String?
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (a: @[FlexibleNullability] kotlin.String?, b: @[FlexibleNullability] kotlin.String?): kotlin.Int declared in <root>.box'
WHEN type=kotlin.Int origin=IF
BRANCH
if: WHEN type=kotlin.Boolean origin=OROR
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 'a: @[FlexibleNullability] kotlin.String? declared in <root>.box.<anonymous>' type=@[FlexibleNullability] kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Boolean type=kotlin.Boolean value=true
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
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 'b: @[FlexibleNullability] kotlin.String? declared in <root>.box.<anonymous>' type=@[FlexibleNullability] kotlin.String? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Int type=kotlin.Int value=0
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun compareTo (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
GET_VAR 'a: @[FlexibleNullability] kotlin.String? declared in <root>.box.<anonymous>' type=@[FlexibleNullability] kotlin.String? origin=null
other: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
GET_VAR 'b: @[FlexibleNullability] kotlin.String? declared in <root>.box.<anonymous>' type=@[FlexibleNullability] kotlin.String? origin=null
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>: java.util.Comparator<kotlin.String>
<R>: kotlin.String
receiver: GET_VAR 'val comparator: java.util.Comparator<kotlin.String> [val] declared in <root>.box' type=java.util.Comparator<kotlin.String> origin=null
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<java.util.Comparator<kotlin.String>, kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:java.util.Comparator<kotlin.String>) returnType:kotlin.String
$receiver: VALUE_PARAMETER name:$this$with type:java.util.Comparator<kotlin.String>
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.box'
CALL 'public final fun <get-min> <T> (<this>: java.util.Comparator<T of <root>.<get-min>>{ kotlin.TypeAliasesKt.Comparator<T of <root>.<get-min>> }): T of <root>.<get-min> declared in <root>' type=kotlin.String origin=GET_PROPERTY
<T>: kotlin.String
$receiver: CONSTRUCTOR_CALL 'public constructor <init> (first: A of <root>.Pair, second: B of <root>.Pair) [primary] declared in <root>.Pair' type=<root>.Pair<kotlin.String, kotlin.String> origin=null
<class: A>: kotlin.String
<class: B>: kotlin.String
first: CONST String type=kotlin.String value="OK"
second: CONST String type=kotlin.String value="fail"
<this>: GET_VAR '$this$with: java.util.Comparator<kotlin.String> declared in <root>.box.<anonymous>' type=java.util.Comparator<kotlin.String> origin=null
@@ -105,8 +105,7 @@ FILE fqName:<root> fileName:/functionalType.kt
CALL 'public final fun f <T> (<this>: <root>.O, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.O, <root>.K, <root>.Param, T of <root>.f>): T of <root>.f declared in <root>' type=kotlin.String origin=null
<T>: kotlin.String
$receiver: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.K' type=<root>.K origin=null
<this>: TYPE_OP type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.O, <root>.K, <root>.Param, kotlin.String> origin=IMPLICIT_CAST typeOperand=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.O, <root>.K, <root>.Param, kotlin.String>
GET_VAR '$this$with: <root>.O declared in <root>.box.<anonymous>' type=<root>.O origin=null
<this>: GET_VAR '$this$with: <root>.O declared in <root>.box.<anonymous>' type=<root>.O origin=null
g: FUN_EXPR type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.O, <root>.K, <root>.Param, kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.K, <this>:<root>.O, it:<root>.Param) returnType:kotlin.String
$receiver: VALUE_PARAMETER name:$this$f type:<root>.K
@@ -39,7 +39,7 @@ fun <T : Any?> K.f(<this>: O, g: @ExtensionFunctionType @ContextFunctionTypePara
fun box(): String {
return with<O, String>(receiver = O(), block = local fun O.<anonymous>(): String {
return K().f<String>(<this> = $this$with /*as @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function3<O, K, Param, String> */, g = local fun K.<anonymous>(<this>: O, it: Param): String {
return K().f<String>(<this> = $this$with, g = local fun K.<anonymous>(<this>: O, it: Param): String {
return $this$with.<get-o>().plus(other = $this$f.<get-k>())
}
)
@@ -174,13 +174,11 @@ FILE fqName:<root> fileName:/functionalType.kt
BLOCK_BODY
CALL 'public final fun f1 (<this>: <root>.C, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.C, <root>.R, <root>.Param, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
$receiver: GET_VAR '$this$with: <root>.R declared in <root>.test.<anonymous>.<anonymous>' type=<root>.R origin=null
<this>: TYPE_OP type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.C, <root>.R, <root>.Param, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.C, <root>.R, <root>.Param, kotlin.Unit>
GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
<this>: GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
g: GET_VAR 'val lf1: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.C, <root>.R, <root>.Param, kotlin.Unit> [val] declared in <root>.test' type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.C, <root>.R, <root>.Param, kotlin.Unit> origin=null
CALL 'public final fun f1 (<this>: <root>.C, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.C, <root>.R, <root>.Param, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
$receiver: GET_VAR '$this$with: <root>.R declared in <root>.test.<anonymous>.<anonymous>' type=<root>.R origin=null
<this>: TYPE_OP type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.C, <root>.R, <root>.Param, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.C, <root>.R, <root>.Param, kotlin.Unit>
GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
<this>: GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
g: FUN_EXPR type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function3<<root>.C, <root>.R, <root>.Param, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.R, <this>:<root>.C, $noName_0:<root>.Param) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:$this$f1 type:<root>.R
@@ -194,12 +192,10 @@ FILE fqName:<root> fileName:/functionalType.kt
CALL 'public final fun <get-c> (): kotlin.Int declared in <root>.C' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
CALL 'public final fun f2 (<this>: <root>.C, g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.Param, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
<this>: TYPE_OP type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.Param, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.Param, kotlin.Unit>
GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
<this>: GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
g: GET_VAR 'val lf2: @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.Param, kotlin.Unit> [val] declared in <root>.test' type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.Param, kotlin.Unit> origin=null
CALL 'public final fun f2 (<this>: <root>.C, g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.Param, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
<this>: TYPE_OP type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.Param, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.Param, kotlin.Unit>
GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
<this>: GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
g: FUN_EXPR type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.Param, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (<this>:<root>.C, $noName_0:<root>.Param) returnType:kotlin.Unit
VALUE_PARAMETER name:<this> index:0 type:<root>.C
@@ -210,13 +206,11 @@ FILE fqName:<root> fileName:/functionalType.kt
$this: GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
CALL 'public final fun f3 (<this>: <root>.C, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.R, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
$receiver: GET_VAR '$this$with: <root>.R declared in <root>.test.<anonymous>.<anonymous>' type=<root>.R origin=null
<this>: TYPE_OP type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.R, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.R, kotlin.Unit>
GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
<this>: GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
g: GET_VAR 'val lf3: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.R, kotlin.Unit> [val] declared in <root>.test' type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.R, kotlin.Unit> origin=null
CALL 'public final fun f3 (<this>: <root>.C, g: @[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.R, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
$receiver: GET_VAR '$this$with: <root>.R declared in <root>.test.<anonymous>.<anonymous>' type=<root>.R origin=null
<this>: TYPE_OP type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.R, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.R, kotlin.Unit>
GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
<this>: GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
g: FUN_EXPR type=@[ExtensionFunctionType] @[ContextFunctionTypeParams(count = '1')] kotlin.Function2<<root>.C, <root>.R, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.R, <this>:<root>.C) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:$this$f3 type:<root>.R
@@ -229,12 +223,10 @@ FILE fqName:<root> fileName:/functionalType.kt
CALL 'public final fun <get-c> (): kotlin.Int declared in <root>.C' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
CALL 'public final fun f4 (<this>: <root>.C, g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function1<<root>.C, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
<this>: TYPE_OP type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<<root>.C, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<<root>.C, kotlin.Unit>
GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
<this>: GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
g: GET_VAR 'val lf4: @[ContextFunctionTypeParams(count = '1')] kotlin.Function1<<root>.C, kotlin.Unit> [val] declared in <root>.test' type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<<root>.C, kotlin.Unit> origin=null
CALL 'public final fun f4 (<this>: <root>.C, g: @[ContextFunctionTypeParams(count = '1')] kotlin.Function1<<root>.C, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
<this>: TYPE_OP type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<<root>.C, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<<root>.C, kotlin.Unit>
GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
<this>: GET_VAR '$this$with: <root>.C declared in <root>.test.<anonymous>' type=<root>.C origin=null
g: FUN_EXPR type=@[ContextFunctionTypeParams(count = '1')] kotlin.Function1<<root>.C, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (<this>:<root>.C) returnType:kotlin.Unit
VALUE_PARAMETER name:<this> index:0 type:<root>.C
@@ -70,25 +70,25 @@ fun test() {
with<C, Unit>(receiver = C(), block = local fun C.<anonymous>() {
with<R, Unit>(receiver = R(), block = local fun R.<anonymous>() {
$this$with.f1(<this> = $this$with /*as @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function3<C, R, Param, Unit> */, g = lf1)
$this$with.f1(<this> = $this$with /*as @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function3<C, R, Param, Unit> */, g = local fun R.<anonymous>(<this>: C, $noName_0: Param) {
$this$with.f1(<this> = $this$with, g = lf1)
$this$with.f1(<this> = $this$with, g = local fun R.<anonymous>(<this>: C, $noName_0: Param) {
$this$f1.<get-r>() /*~> Unit */
$this$with.<get-c>() /*~> Unit */
}
)
f2(<this> = $this$with /*as @ContextFunctionTypeParams(count = 1) Function2<C, Param, Unit> */, g = lf2)
f2(<this> = $this$with /*as @ContextFunctionTypeParams(count = 1) Function2<C, Param, Unit> */, g = local fun <anonymous>(<this>: C, $noName_0: Param) {
f2(<this> = $this$with, g = lf2)
f2(<this> = $this$with, g = local fun <anonymous>(<this>: C, $noName_0: Param) {
$this$with.<get-c>() /*~> Unit */
}
)
$this$with.f3(<this> = $this$with /*as @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function2<C, R, Unit> */, g = lf3)
$this$with.f3(<this> = $this$with /*as @ExtensionFunctionType @ContextFunctionTypeParams(count = 1) Function2<C, R, Unit> */, g = local fun R.<anonymous>(<this>: C) {
$this$with.f3(<this> = $this$with, g = lf3)
$this$with.f3(<this> = $this$with, g = local fun R.<anonymous>(<this>: C) {
$this$f3.<get-r>() /*~> Unit */
$this$with.<get-c>() /*~> Unit */
}
)
f4(<this> = $this$with /*as @ContextFunctionTypeParams(count = 1) Function1<C, Unit> */, g = lf4)
f4(<this> = $this$with /*as @ContextFunctionTypeParams(count = 1) Function1<C, Unit> */, g = local fun <anonymous>(<this>: C) {
f4(<this> = $this$with, g = lf4)
f4(<this> = $this$with, g = local fun <anonymous>(<this>: C) {
$this$with.<get-c>() /*~> Unit */
}
)
@@ -52,12 +52,10 @@ FILE fqName:<root> fileName:/plusMatrix.kt
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun plus (<this>: <root>.NumberOperations, other: <root>.Matrix): <root>.Matrix declared in <root>' type=<root>.Matrix origin=null
$receiver: GET_VAR 'm1: <root>.Matrix declared in <root>.plusMatrix' type=<root>.Matrix origin=null
<this>: TYPE_OP type=<root>.Matrix origin=IMPLICIT_CAST typeOperand=<root>.Matrix
GET_VAR '<this>: <root>.NumberOperations declared in <root>.plusMatrix' type=<root>.NumberOperations origin=null
<this>: GET_VAR '<this>: <root>.NumberOperations declared in <root>.plusMatrix' type=<root>.NumberOperations origin=null
other: GET_VAR 'm2: <root>.Matrix declared in <root>.plusMatrix' type=<root>.Matrix origin=null
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun plus (<this>: <root>.NumberOperations, other: <root>.Matrix): <root>.Matrix declared in <root>' type=<root>.Matrix origin=null
$receiver: GET_VAR 'm2: <root>.Matrix declared in <root>.plusMatrix' type=<root>.Matrix origin=null
<this>: TYPE_OP type=<root>.Matrix origin=IMPLICIT_CAST typeOperand=<root>.Matrix
GET_VAR '<this>: <root>.NumberOperations declared in <root>.plusMatrix' type=<root>.NumberOperations origin=null
<this>: GET_VAR '<this>: <root>.NumberOperations declared in <root>.plusMatrix' type=<root>.NumberOperations origin=null
other: GET_VAR 'm1: <root>.Matrix declared in <root>.plusMatrix' type=<root>.Matrix origin=null
@@ -17,6 +17,6 @@ fun Matrix.plus(<this>: NumberOperations, other: Matrix): Matrix {
}
fun NumberOperations.plusMatrix(m1: Matrix, m2: Matrix) {
m1.plus(<this> = <this> /*as Matrix */, other = m2) /*~> Unit */
m2.plus(<this> = <this> /*as Matrix */, other = m1) /*~> Unit */
m1.plus(<this> = <this>, other = m2) /*~> Unit */
m2.plus(<this> = <this>, other = m1) /*~> Unit */
}
@@ -15946,6 +15946,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/extensionClasses/constructors.kt");
}
@Test
@TestMetadata("contextualPrimaryConstructorWithParams.kt")
public void testContextualPrimaryConstructorWithParams() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/contextualPrimaryConstructorWithParams.kt");
}
@Test
@TestMetadata("edouble.kt")
public void testEdouble() throws Exception {
@@ -757,6 +757,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
runTest("compiler/testData/ir/irText/declarations/contextReceivers/class.kt");
}
@Test
@TestMetadata("contextualPrimaryConstructorWithParams.kt")
public void testContextualPrimaryConstructorWithParams() throws Exception {
runTest("compiler/testData/ir/irText/declarations/contextReceivers/contextualPrimaryConstructorWithParams.kt");
}
@Test
@TestMetadata("function.kt")
public void testFunction() throws Exception {
@@ -608,6 +608,11 @@ public class KlibTextTestCaseGenerated extends AbstractKlibTextTestCase {
runTest("compiler/testData/ir/irText/declarations/contextReceivers/class.kt");
}
@TestMetadata("contextualPrimaryConstructorWithParams.kt")
public void testContextualPrimaryConstructorWithParams() throws Exception {
runTest("compiler/testData/ir/irText/declarations/contextReceivers/contextualPrimaryConstructorWithParams.kt");
}
@TestMetadata("function.kt")
public void testFunction() throws Exception {
runTest("compiler/testData/ir/irText/declarations/contextReceivers/function.kt");