From 13d14df8ae25e0a3535ad337fae56632e1050904 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 28 Aug 2019 14:50:40 +0300 Subject: [PATCH] FIR: set dispatch receiver for data class generated functions --- .../converter/DeclarationsConverter.kt | 4 +++- .../kotlin/fir/builder/DataClassUtils.kt | 15 ++++++++----- .../kotlin/fir/builder/RawFirBuilder.kt | 3 ++- .../rawBuilder/expressions/destructuring.txt | 8 +++---- .../testData/rawBuilder/expressions/for.txt | 6 ++--- .../rawBuilder/expressions/lambda.txt | 6 ++--- .../fir/resolve/testData/resolve/copy.txt | 6 ++--- .../testData/resolve/stdlib/components.txt | 6 ++--- .../classes/dataClassWithArrayMembers.fir.txt | 22 +++++++++++++++++++ .../ir/irText/classes/dataClasses.fir.txt | 16 ++++++++++++++ .../irText/classes/dataClassesGeneric.fir.txt | 8 +++++++ .../lambdaInDataClassDefaultParameter.fir.txt | 4 ++++ .../parameters/dataClassMembers.fir.txt | 4 ++++ .../lambdas/destructuringInLambda.fir.txt | 4 ++++ 14 files changed, 89 insertions(+), 23 deletions(-) diff --git a/compiler/fir/lightTree/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt b/compiler/fir/lightTree/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt index 18dffdcce43..e49816b48c8 100644 --- a/compiler/fir/lightTree/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt +++ b/compiler/fir/lightTree/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt @@ -406,7 +406,9 @@ class DeclarationsConverter( //parse data class if (modifiers.isDataClass() && firPrimaryConstructor != null) { val zippedParameters = MutableList(properties.size) { null }.zip(properties) - zippedParameters.generateComponentFunctions(session, firClass, context.packageFqName, context.className) + zippedParameters.generateComponentFunctions( + session, firClass, context.packageFqName, context.className, firPrimaryConstructor + ) zippedParameters.generateCopyFunction( session, null, firClass, context.packageFqName, context.className, firPrimaryConstructor ) diff --git a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/DataClassUtils.kt b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/DataClassUtils.kt index 2b15718346b..30010d7021e 100644 --- a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/DataClassUtils.kt +++ b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/DataClassUtils.kt @@ -15,19 +15,19 @@ import org.jetbrains.kotlin.fir.declarations.impl.FirClassImpl import org.jetbrains.kotlin.fir.declarations.impl.FirMemberFunctionImpl import org.jetbrains.kotlin.fir.declarations.impl.FirValueParameterImpl import org.jetbrains.kotlin.fir.expressions.impl.* +import org.jetbrains.kotlin.fir.references.FirImplicitThisReference import org.jetbrains.kotlin.fir.references.FirResolvedCallableReferenceImpl import org.jetbrains.kotlin.fir.symbols.CallableId import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol -import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.fir.types.impl.FirImplicitTypeRefImpl import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtClassOrObject import org.jetbrains.kotlin.psi.KtParameter -import org.jetbrains.kotlin.psi.KtTypeReference fun List>.generateComponentFunctions( - session: FirSession, firClass: FirClassImpl, packageFqName: FqName, classFqName: FqName + session: FirSession, firClass: FirClassImpl, packageFqName: FqName, classFqName: FqName, + firPrimaryConstructor: FirConstructor ) { var componentIndex = 1 for ((ktParameter, firProperty) in this) { @@ -52,6 +52,9 @@ fun List>.generateComponentFunctions( ktParameter, FirQualifiedAccessExpressionImpl(ktParameter).apply { val parameterName = firProperty.name + dispatchReceiver = FirThisReceiverExpressionImpl(null, FirImplicitThisReference(firClass.symbol)).apply { + typeRef = firPrimaryConstructor.returnTypeRef + } calleeReference = FirResolvedCallableReferenceImpl( ktParameter, parameterName, firProperty.symbol @@ -83,15 +86,17 @@ fun List>.generateCopyFunction( isInfix = false, isInline = false, isTailRec = false, isExternal = false, isSuspend = false, receiverTypeRef = null, - returnTypeRef = firPrimaryConstructor.returnTypeRef//FirImplicitTypeRefImpl(session, this) + returnTypeRef = firPrimaryConstructor.returnTypeRef ).apply { - val copyFunction = this for ((ktParameter, firProperty) in this@generateCopyFunction) { val name = firProperty.name valueParameters += FirValueParameterImpl( session, ktParameter, name, firProperty.returnTypeRef, FirQualifiedAccessExpressionImpl(ktParameter).apply { + dispatchReceiver = FirThisReceiverExpressionImpl(null, FirImplicitThisReference(firClass.symbol)).apply { + typeRef = firPrimaryConstructor.returnTypeRef + } calleeReference = FirResolvedCallableReferenceImpl(ktParameter, name, firProperty.symbol) }, isCrossinline = false, isNoinline = false, isVararg = false diff --git a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt index ab09a67145c..c084ef97572 100644 --- a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt +++ b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt @@ -491,7 +491,8 @@ class RawFirBuilder(session: FirSession, val stubMode: Boolean) : BaseFirBuilder val zippedParameters = classOrObject.primaryConstructorParameters.zip( firClass.declarations.filterIsInstance() ) - zippedParameters.generateComponentFunctions(session, firClass, context.packageFqName, context.className) + zippedParameters.generateComponentFunctions( + session, firClass, context.packageFqName, context.className, firPrimaryConstructor) zippedParameters.generateCopyFunction( session, classOrObject, firClass, context.packageFqName, context.className, firPrimaryConstructor ) diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/destructuring.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/destructuring.txt index 47bae7e9f22..0d067140544 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/destructuring.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/destructuring.txt @@ -14,18 +14,18 @@ FILE: destructuring.kt public? get(): String public final fun component1(): { - ^component1 R|/Some.first| + ^component1 D|this@R|/Some||.R|/Some.first| } public final fun component2(): { - ^component2 R|/Some.second| + ^component2 D|this@R|/Some||.R|/Some.second| } public final fun component3(): { - ^component3 R|/Some.third| + ^component3 D|this@R|/Some||.R|/Some.third| } - public final fun copy(first: Int = R|/Some.first|, second: Double = R|/Some.second|, third: String = R|/Some.third|): R|Some| { + public final fun copy(first: Int = D|this@R|/Some||.R|/Some.first|, second: Double = D|this@R|/Some||.R|/Some.second|, third: String = D|this@R|/Some||.R|/Some.third|): R|Some| { } } diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/for.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/for.txt index 69dde8bf27f..dfa9ae8f264 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/for.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/for.txt @@ -36,14 +36,14 @@ FILE: for.kt public? get(): Int public final fun component1(): { - ^component1 R|/Some.x| + ^component1 D|this@R|/Some||.R|/Some.x| } public final fun component2(): { - ^component2 R|/Some.y| + ^component2 D|this@R|/Some||.R|/Some.y| } - public final fun copy(x: Int = R|/Some.x|, y: Int = R|/Some.y|): R|Some| { + public final fun copy(x: Int = D|this@R|/Some||.R|/Some.x|, y: Int = D|this@R|/Some||.R|/Some.y|): R|Some| { } } diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/lambda.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/lambda.txt index b7e17ee2ef6..57c36128e49 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/lambda.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/lambda.txt @@ -11,14 +11,14 @@ FILE: lambda.kt public? get(): Int public final fun component1(): { - ^component1 R|/Tuple.x| + ^component1 D|this@R|/Tuple||.R|/Tuple.x| } public final fun component2(): { - ^component2 R|/Tuple.y| + ^component2 D|this@R|/Tuple||.R|/Tuple.y| } - public final fun copy(x: Int = R|/Tuple.x|, y: Int = R|/Tuple.y|): R|Tuple| { + public final fun copy(x: Int = D|this@R|/Tuple||.R|/Tuple.x|, y: Int = D|this@R|/Tuple||.R|/Tuple.y|): R|Tuple| { } } diff --git a/compiler/fir/resolve/testData/resolve/copy.txt b/compiler/fir/resolve/testData/resolve/copy.txt index 3c65c14f165..6b0efa73ca7 100644 --- a/compiler/fir/resolve/testData/resolve/copy.txt +++ b/compiler/fir/resolve/testData/resolve/copy.txt @@ -11,14 +11,14 @@ FILE: copy.kt public get(): R|kotlin/String| public final fun component1(): R|kotlin/Int| { - ^component1 R|/Some.x| + ^component1 D|this@R|/Some||.R|/Some.x| } public final fun component2(): R|kotlin/String| { - ^component2 R|/Some.y| + ^component2 D|this@R|/Some||.R|/Some.y| } - public final fun copy(x: R|kotlin/Int| = R|/Some.x|, y: R|kotlin/String| = R|/Some.y|): R|Some| { + public final fun copy(x: R|kotlin/Int| = D|this@R|/Some||.R|/Some.x|, y: R|kotlin/String| = D|this@R|/Some||.R|/Some.y|): R|Some| { } } diff --git a/compiler/fir/resolve/testData/resolve/stdlib/components.txt b/compiler/fir/resolve/testData/resolve/stdlib/components.txt index 9faf9510aca..1bf851f00a7 100644 --- a/compiler/fir/resolve/testData/resolve/stdlib/components.txt +++ b/compiler/fir/resolve/testData/resolve/stdlib/components.txt @@ -11,14 +11,14 @@ FILE: components.kt public get(): R|kotlin/String| public final fun component1(): R|kotlin/Int| { - ^component1 R|/D.x| + ^component1 D|this@R|/D||.R|/D.x| } public final fun component2(): R|kotlin/String| { - ^component2 R|/D.y| + ^component2 D|this@R|/D||.R|/D.y| } - public final fun copy(x: R|kotlin/Int| = R|/D.x|, y: R|kotlin/String| = R|/D.y|): R|D| { + public final fun copy(x: R|kotlin/Int| = D|this@R|/D||.R|/D.x|, y: R|kotlin/String| = D|this@R|/D||.R|/D.y|): R|D| { } } diff --git a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.txt b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.txt index 0feae546868..c1efbb73984 100644 --- a/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.txt +++ b/compiler/testData/ir/irText/classes/dataClassWithArrayMembers.fir.txt @@ -118,75 +118,93 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Array declared in .Test1' CALL 'public final fun (): kotlin.Array declared in .Test1' type=kotlin.Array origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null FUN name:component2 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.CharArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.CharArray declared in .Test1' CALL 'public final fun (): kotlin.CharArray declared in .Test1' type=kotlin.CharArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null FUN name:component3 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.BooleanArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component3 (): kotlin.BooleanArray declared in .Test1' CALL 'public final fun (): kotlin.BooleanArray declared in .Test1' type=kotlin.BooleanArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null FUN name:component4 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.ByteArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component4 (): kotlin.ByteArray declared in .Test1' CALL 'public final fun (): kotlin.ByteArray declared in .Test1' type=kotlin.ByteArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null FUN name:component5 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.ShortArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component5 (): kotlin.ShortArray declared in .Test1' CALL 'public final fun (): kotlin.ShortArray declared in .Test1' type=kotlin.ShortArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null FUN name:component6 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.IntArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component6 (): kotlin.IntArray declared in .Test1' CALL 'public final fun (): kotlin.IntArray declared in .Test1' type=kotlin.IntArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null FUN name:component7 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.LongArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component7 (): kotlin.LongArray declared in .Test1' CALL 'public final fun (): kotlin.LongArray declared in .Test1' type=kotlin.LongArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null FUN name:component8 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.FloatArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component8 (): kotlin.FloatArray declared in .Test1' CALL 'public final fun (): kotlin.FloatArray declared in .Test1' type=kotlin.FloatArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null FUN name:component9 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.DoubleArray $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component9 (): kotlin.DoubleArray declared in .Test1' CALL 'public final fun (): kotlin.DoubleArray declared in .Test1' type=kotlin.DoubleArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test1, stringArray:kotlin.Array, charArray:kotlin.CharArray, booleanArray:kotlin.BooleanArray, byteArray:kotlin.ByteArray, shortArray:kotlin.ShortArray, intArray:kotlin.IntArray, longArray:kotlin.LongArray, floatArray:kotlin.FloatArray, doubleArray:kotlin.DoubleArray) returnType:.Test1 $this: VALUE_PARAMETER name: type:.Test1 VALUE_PARAMETER name:stringArray index:0 type:kotlin.Array EXPRESSION_BODY CALL 'public final fun (): kotlin.Array declared in .Test1' type=kotlin.Array origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null VALUE_PARAMETER name:charArray index:1 type:kotlin.CharArray EXPRESSION_BODY CALL 'public final fun (): kotlin.CharArray declared in .Test1' type=kotlin.CharArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null VALUE_PARAMETER name:booleanArray index:2 type:kotlin.BooleanArray EXPRESSION_BODY CALL 'public final fun (): kotlin.BooleanArray declared in .Test1' type=kotlin.BooleanArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null VALUE_PARAMETER name:byteArray index:3 type:kotlin.ByteArray EXPRESSION_BODY CALL 'public final fun (): kotlin.ByteArray declared in .Test1' type=kotlin.ByteArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null VALUE_PARAMETER name:shortArray index:4 type:kotlin.ShortArray EXPRESSION_BODY CALL 'public final fun (): kotlin.ShortArray declared in .Test1' type=kotlin.ShortArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null VALUE_PARAMETER name:intArray index:5 type:kotlin.IntArray EXPRESSION_BODY CALL 'public final fun (): kotlin.IntArray declared in .Test1' type=kotlin.IntArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null VALUE_PARAMETER name:longArray index:6 type:kotlin.LongArray EXPRESSION_BODY CALL 'public final fun (): kotlin.LongArray declared in .Test1' type=kotlin.LongArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null VALUE_PARAMETER name:floatArray index:7 type:kotlin.FloatArray EXPRESSION_BODY CALL 'public final fun (): kotlin.FloatArray declared in .Test1' type=kotlin.FloatArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null VALUE_PARAMETER name:doubleArray index:8 type:kotlin.DoubleArray EXPRESSION_BODY CALL 'public final fun (): kotlin.DoubleArray declared in .Test1' type=kotlin.DoubleArray origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: @@ -225,11 +243,13 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Array.Test2> declared in .Test2' CALL 'public final fun (): kotlin.Array.Test2> declared in .Test2' type=kotlin.Array.Test2> origin=null + $this: GET_VAR ': .Test2 declared in .Test2' type=.Test2> origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test2, genericArray:kotlin.Array.Test2>) returnType:.Test2> $this: VALUE_PARAMETER name: type:.Test2 VALUE_PARAMETER name:genericArray index:0 type:kotlin.Array.Test2> EXPRESSION_BODY CALL 'public final fun (): kotlin.Array.Test2> declared in .Test2' type=kotlin.Array.Test2> origin=null + $this: GET_VAR ': .Test2 declared in .Test2' type=.Test2> origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: @@ -267,11 +287,13 @@ FILE fqName: fileName:/dataClassWithArrayMembers.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Array? declared in .Test3' CALL 'public final fun (): kotlin.Array? declared in .Test3' type=kotlin.Array? origin=null + $this: GET_VAR ': .Test3 declared in .Test3' type=.Test3 origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test3, anyArrayN:kotlin.Array?) returnType:.Test3 $this: VALUE_PARAMETER name: type:.Test3 VALUE_PARAMETER name:anyArrayN index:0 type:kotlin.Array? EXPRESSION_BODY CALL 'public final fun (): kotlin.Array? declared in .Test3' type=kotlin.Array? origin=null + $this: GET_VAR ': .Test3 declared in .Test3' type=.Test3 origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: diff --git a/compiler/testData/ir/irText/classes/dataClasses.fir.txt b/compiler/testData/ir/irText/classes/dataClasses.fir.txt index 20fb40a4180..c6d057591e8 100644 --- a/compiler/testData/ir/irText/classes/dataClasses.fir.txt +++ b/compiler/testData/ir/irText/classes/dataClasses.fir.txt @@ -46,27 +46,33 @@ FILE fqName: fileName:/dataClasses.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int declared in .Test1' CALL 'public final fun (): kotlin.Int declared in .Test1' type=kotlin.Int origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null FUN name:component2 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.String $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.String declared in .Test1' CALL 'public final fun (): kotlin.String declared in .Test1' type=kotlin.String origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null FUN name:component3 visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.Any $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component3 (): kotlin.Any declared in .Test1' CALL 'public final fun (): kotlin.Any declared in .Test1' type=kotlin.Any origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test1, x:kotlin.Int, y:kotlin.String, z:kotlin.Any) returnType:.Test1 $this: VALUE_PARAMETER name: type:.Test1 VALUE_PARAMETER name:x index:0 type:kotlin.Int EXPRESSION_BODY CALL 'public final fun (): kotlin.Int declared in .Test1' type=kotlin.Int origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null VALUE_PARAMETER name:y index:1 type:kotlin.String EXPRESSION_BODY CALL 'public final fun (): kotlin.String declared in .Test1' type=kotlin.String origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null VALUE_PARAMETER name:z index:2 type:kotlin.Any EXPRESSION_BODY CALL 'public final fun (): kotlin.Any declared in .Test1' type=kotlin.Any origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: @@ -104,11 +110,13 @@ FILE fqName: fileName:/dataClasses.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Any? declared in .Test2' CALL 'public final fun (): kotlin.Any? declared in .Test2' type=kotlin.Any? origin=null + $this: GET_VAR ': .Test2 declared in .Test2' type=.Test2 origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test2, x:kotlin.Any?) returnType:.Test2 $this: VALUE_PARAMETER name: type:.Test2 VALUE_PARAMETER name:x index:0 type:kotlin.Any? EXPRESSION_BODY CALL 'public final fun (): kotlin.Any? declared in .Test2' type=kotlin.Any? origin=null + $this: GET_VAR ': .Test2 declared in .Test2' type=.Test2 origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: @@ -182,35 +190,43 @@ FILE fqName: fileName:/dataClasses.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Double declared in .Test3' CALL 'public final fun (): kotlin.Double declared in .Test3' type=kotlin.Double origin=null + $this: GET_VAR ': .Test3 declared in .Test3' type=.Test3 origin=null FUN name:component2 visibility:public modality:FINAL <> ($this:.Test3) returnType:kotlin.Double? $this: VALUE_PARAMETER name: type:.Test3 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.Double? declared in .Test3' CALL 'public final fun (): kotlin.Double? declared in .Test3' type=kotlin.Double? origin=null + $this: GET_VAR ': .Test3 declared in .Test3' type=.Test3 origin=null FUN name:component3 visibility:public modality:FINAL <> ($this:.Test3) returnType:kotlin.Float $this: VALUE_PARAMETER name: type:.Test3 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component3 (): kotlin.Float declared in .Test3' CALL 'public final fun (): kotlin.Float declared in .Test3' type=kotlin.Float origin=null + $this: GET_VAR ': .Test3 declared in .Test3' type=.Test3 origin=null FUN name:component4 visibility:public modality:FINAL <> ($this:.Test3) returnType:kotlin.Float? $this: VALUE_PARAMETER name: type:.Test3 BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component4 (): kotlin.Float? declared in .Test3' CALL 'public final fun (): kotlin.Float? declared in .Test3' type=kotlin.Float? origin=null + $this: GET_VAR ': .Test3 declared in .Test3' type=.Test3 origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test3, d:kotlin.Double, dn:kotlin.Double?, f:kotlin.Float, df:kotlin.Float?) returnType:.Test3 $this: VALUE_PARAMETER name: type:.Test3 VALUE_PARAMETER name:d index:0 type:kotlin.Double EXPRESSION_BODY CALL 'public final fun (): kotlin.Double declared in .Test3' type=kotlin.Double origin=null + $this: GET_VAR ': .Test3 declared in .Test3' type=.Test3 origin=null VALUE_PARAMETER name:dn index:1 type:kotlin.Double? EXPRESSION_BODY CALL 'public final fun (): kotlin.Double? declared in .Test3' type=kotlin.Double? origin=null + $this: GET_VAR ': .Test3 declared in .Test3' type=.Test3 origin=null VALUE_PARAMETER name:f index:2 type:kotlin.Float EXPRESSION_BODY CALL 'public final fun (): kotlin.Float declared in .Test3' type=kotlin.Float origin=null + $this: GET_VAR ': .Test3 declared in .Test3' type=.Test3 origin=null VALUE_PARAMETER name:df index:3 type:kotlin.Float? EXPRESSION_BODY CALL 'public final fun (): kotlin.Float? declared in .Test3' type=kotlin.Float? origin=null + $this: GET_VAR ': .Test3 declared in .Test3' type=.Test3 origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: diff --git a/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.txt b/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.txt index 80e04d109f0..d7dfd83f161 100644 --- a/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.txt +++ b/compiler/testData/ir/irText/classes/dataClassesGeneric.fir.txt @@ -23,11 +23,13 @@ FILE fqName: fileName:/dataClassesGeneric.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): T of .Test1 declared in .Test1' CALL 'public final fun (): T of .Test1 declared in .Test1' type=T of .Test1 origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1> origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test1, x:T of .Test1) returnType:.Test1> $this: VALUE_PARAMETER name: type:.Test1 VALUE_PARAMETER name:x index:0 type:T of .Test1 EXPRESSION_BODY CALL 'public final fun (): T of .Test1 declared in .Test1' type=T of .Test1 origin=null + $this: GET_VAR ': .Test1 declared in .Test1' type=.Test1> origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: @@ -66,11 +68,13 @@ FILE fqName: fileName:/dataClassesGeneric.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): T of .Test2 declared in .Test2' CALL 'public final fun (): T of .Test2 declared in .Test2' type=T of .Test2 origin=null + $this: GET_VAR ': .Test2 declared in .Test2' type=.Test2> origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test2, x:T of .Test2) returnType:.Test2> $this: VALUE_PARAMETER name: type:.Test2 VALUE_PARAMETER name:x index:0 type:T of .Test2 EXPRESSION_BODY CALL 'public final fun (): T of .Test2 declared in .Test2' type=T of .Test2 origin=null + $this: GET_VAR ': .Test2 declared in .Test2' type=.Test2> origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: @@ -109,11 +113,13 @@ FILE fqName: fileName:/dataClassesGeneric.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.collections.List.Test3> declared in .Test3' CALL 'public final fun (): kotlin.collections.List.Test3> declared in .Test3' type=kotlin.collections.List.Test3> origin=null + $this: GET_VAR ': .Test3 declared in .Test3' type=.Test3> origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test3, x:kotlin.collections.List.Test3>) returnType:.Test3> $this: VALUE_PARAMETER name: type:.Test3 VALUE_PARAMETER name:x index:0 type:kotlin.collections.List.Test3> EXPRESSION_BODY CALL 'public final fun (): kotlin.collections.List.Test3> declared in .Test3' type=kotlin.collections.List.Test3> origin=null + $this: GET_VAR ': .Test3 declared in .Test3' type=.Test3> origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: @@ -151,11 +157,13 @@ FILE fqName: fileName:/dataClassesGeneric.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.collections.List declared in .Test4' CALL 'public final fun (): kotlin.collections.List declared in .Test4' type=kotlin.collections.List origin=null + $this: GET_VAR ': .Test4 declared in .Test4' type=.Test4 origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test4, x:kotlin.collections.List) returnType:.Test4 $this: VALUE_PARAMETER name: type:.Test4 VALUE_PARAMETER name:x index:0 type:kotlin.collections.List EXPRESSION_BODY CALL 'public final fun (): kotlin.collections.List declared in .Test4' type=kotlin.collections.List origin=null + $this: GET_VAR ': .Test4 declared in .Test4' type=.Test4 origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: diff --git a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt index 640354b859c..bb07a4c258b 100644 --- a/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt +++ b/compiler/testData/ir/irText/classes/lambdaInDataClassDefaultParameter.fir.txt @@ -27,11 +27,13 @@ FILE fqName: fileName:/lambdaInDataClassDefaultParameter.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Function2<.A, kotlin.String, kotlin.Unit> declared in .A' CALL 'public final fun (): kotlin.Function2<.A, kotlin.String, kotlin.Unit> declared in .A' type=kotlin.Function2<.A, kotlin.String, kotlin.Unit> origin=null + $this: GET_VAR ': .A declared in .A' type=.A origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.A, runA:kotlin.Function2<.A, kotlin.String, kotlin.Unit>) returnType:.A $this: VALUE_PARAMETER name: type:.A VALUE_PARAMETER name:runA index:0 type:kotlin.Function2<.A, kotlin.String, kotlin.Unit> EXPRESSION_BODY CALL 'public final fun (): kotlin.Function2<.A, kotlin.String, kotlin.Unit> declared in .A' type=kotlin.Function2<.A, kotlin.String, kotlin.Unit> origin=null + $this: GET_VAR ': .A declared in .A' type=.A origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: @@ -78,11 +80,13 @@ FILE fqName: fileName:/lambdaInDataClassDefaultParameter.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Any declared in .B' CALL 'public final fun (): kotlin.Any declared in .B' type=kotlin.Any origin=null + $this: GET_VAR ': .B declared in .B' type=.B origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.B, x:kotlin.Any) returnType:.B $this: VALUE_PARAMETER name: type:.B VALUE_PARAMETER name:x index:0 type:kotlin.Any EXPRESSION_BODY CALL 'public final fun (): kotlin.Any declared in .B' type=kotlin.Any origin=null + $this: GET_VAR ': .B declared in .B' type=.B origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: diff --git a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.txt b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.txt index 3da0321ecb5..f32d8dd56df 100644 --- a/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.txt +++ b/compiler/testData/ir/irText/declarations/parameters/dataClassMembers.fir.txt @@ -37,19 +37,23 @@ FILE fqName: fileName:/dataClassMembers.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): T of .Test declared in .Test' CALL 'public final fun (): T of .Test declared in .Test' type=T of .Test origin=null + $this: GET_VAR ': .Test declared in .Test' type=.Test> origin=null FUN name:component2 visibility:public modality:FINAL <> ($this:.Test) returnType:kotlin.String $this: VALUE_PARAMETER name: type:.Test BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.String declared in .Test' CALL 'public final fun (): kotlin.String declared in .Test' type=kotlin.String origin=null + $this: GET_VAR ': .Test declared in .Test' type=.Test> origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.Test, x:T of .Test, y:kotlin.String) returnType:.Test> $this: VALUE_PARAMETER name: type:.Test VALUE_PARAMETER name:x index:0 type:T of .Test EXPRESSION_BODY CALL 'public final fun (): T of .Test declared in .Test' type=T of .Test origin=null + $this: GET_VAR ': .Test declared in .Test' type=.Test> origin=null VALUE_PARAMETER name:y index:1 type:kotlin.String EXPRESSION_BODY CALL 'public final fun (): kotlin.String declared in .Test' type=kotlin.String origin=null + $this: GET_VAR ': .Test declared in .Test' type=.Test> origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: diff --git a/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.txt b/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.txt index a34b8e3c857..a5cb546288e 100644 --- a/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.txt +++ b/compiler/testData/ir/irText/lambdas/destructuringInLambda.fir.txt @@ -34,19 +34,23 @@ FILE fqName: fileName:/destructuringInLambda.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Int declared in .A' CALL 'public final fun (): kotlin.Int declared in .A' type=kotlin.Int origin=null + $this: GET_VAR ': .A declared in .A' type=.A origin=null FUN name:component2 visibility:public modality:FINAL <> ($this:.A) returnType:kotlin.Int $this: VALUE_PARAMETER name: type:.A BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun component2 (): kotlin.Int declared in .A' CALL 'public final fun (): kotlin.Int declared in .A' type=kotlin.Int origin=null + $this: GET_VAR ': .A declared in .A' type=.A origin=null FUN name:copy visibility:public modality:FINAL <> ($this:.A, x:kotlin.Int, y:kotlin.Int) returnType:.A $this: VALUE_PARAMETER name: type:.A VALUE_PARAMETER name:x index:0 type:kotlin.Int EXPRESSION_BODY CALL 'public final fun (): kotlin.Int declared in .A' type=kotlin.Int origin=null + $this: GET_VAR ': .A declared in .A' type=.A origin=null VALUE_PARAMETER name:y index:1 type:kotlin.Int EXPRESSION_BODY CALL 'public final fun (): kotlin.Int declared in .A' type=kotlin.Int origin=null + $this: GET_VAR ': .A declared in .A' type=.A origin=null BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: