From 57bbfbbfccb1742be8014ac166d76aaefa2b81f6 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 21 Jan 2020 14:26:49 +0300 Subject: [PATCH] PSI2IR: capture adapted reference receiver to a local val if required --- .../kotlin/fir/Fir2IrTextTestGenerated.java | 10 ++ .../ReflectionReferencesGenerator.kt | 66 +++++++++-- .../constructorWithAdaptedArguments.fir.txt | 83 +++++++++++++ .../constructorWithAdaptedArguments.kt | 15 +++ .../constructorWithAdaptedArguments.txt | 112 ++++++++++++++++++ .../withArgumentAdaptationAndReceiver.fir.txt | 62 ++++++++++ .../withArgumentAdaptationAndReceiver.kt | 29 +++++ .../withArgumentAdaptationAndReceiver.txt | 111 +++++++++++++++++ .../kotlin/ir/IrTextTestCaseGenerated.java | 10 ++ 9 files changed, 488 insertions(+), 10 deletions(-) create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.fir.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.fir.txt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt create mode 100644 compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.txt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index 32eb0e19a0c..1e10c2239ad 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1349,6 +1349,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/callableReferences"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("constructorWithAdaptedArguments.kt") + public void testConstructorWithAdaptedArguments() throws Exception { + runTest("compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt"); + } + @TestMetadata("genericMember.kt") public void testGenericMember() throws Exception { runTest("compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt"); @@ -1369,6 +1374,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt"); } + @TestMetadata("withArgumentAdaptationAndReceiver.kt") + public void testWithArgumentAdaptationAndReceiver() throws Exception { + runTest("compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt"); + } + @TestMetadata("withVarargViewedAsArray.kt") public void testWithVarargViewedAsArray() throws Exception { runTest("compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt"); diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt index c159f110198..3a5fbfda2fb 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ReflectionReferencesGenerator.kt @@ -18,9 +18,7 @@ package org.jetbrains.kotlin.psi2ir.generators import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction -import org.jetbrains.kotlin.ir.declarations.MetadataSource +import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl import org.jetbrains.kotlin.ir.descriptors.WrappedSimpleFunctionDescriptor @@ -42,6 +40,7 @@ import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.calls.model.* import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.expressions.DoubleColonLHS +import org.jetbrains.kotlin.utils.addIfNotNull class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : StatementGeneratorExtension(statementGenerator) { @@ -99,6 +98,8 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St } } + private val adapterOrigin = IrDeclarationOrigin.DEFINED // TODO special declaration origin for callable reference adapter? + private fun isTrivialArgumentAdaptation(irAdapteeCall: IrFunctionAccessExpression): Boolean { for (i in 0 until irAdapteeCall.valueArgumentsCount) { val irValueArgument = irAdapteeCall.getValueArgument(i) ?: return false @@ -138,8 +139,12 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St val ktExpectedParameterTypes = ktFunctionalTypeArguments.take(ktFunctionalTypeArguments.size - 1).map { it.type } val irAdapterFun = createAdapterFun(startOffset, endOffset, adapteeDescriptor, ktExpectedParameterTypes, ktExpectedReturnType) - val (irCall, irAdapteeCallInner) = - createAdapteeCall(startOffset, endOffset, ktCallableReference, adapteeSymbol, callBuilder, irAdapterFun) + val adapteeCall = createAdapteeCall(startOffset, endOffset, ktCallableReference, adapteeSymbol, callBuilder, irAdapterFun) + val irCall = adapteeCall.callExpression + val irAdapteeCallInner = adapteeCall.innerCallExpression + + val tmpDispatchReceiver = adapteeCall.tmpDispatchReceiver + val tmpExtensionReceiver = adapteeCall.tmpExtensionReceiver irAdapterFun.body = IrBlockBodyImpl(startOffset, endOffset).apply { if (KotlinBuiltIns.isUnit(ktExpectedReturnType)) @@ -149,6 +154,8 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St } val irBlock = IrBlockImpl(startOffset, endOffset, irFunctionalType).apply { + statements.addIfNotNull(tmpDispatchReceiver) + statements.addIfNotNull(tmpExtensionReceiver) statements.add(irAdapterFun) statements.add( IrFunctionReferenceImpl( @@ -167,6 +174,13 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St ) } + private class AdapteeCall( + val callExpression: IrExpression, + val innerCallExpression: IrFunctionAccessExpression, + val tmpDispatchReceiver: IrVariable?, + val tmpExtensionReceiver: IrVariable? + ) + private fun createAdapteeCall( startOffset: Int, endOffset: Int, @@ -174,11 +188,14 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St adapteeSymbol: IrFunctionSymbol, callBuilder: CallBuilder, irAdapterFun: IrSimpleFunction - ): Pair { + ): AdapteeCall { val resolvedCall = callBuilder.original val resolvedDescriptor = resolvedCall.resultingDescriptor var irAdapteeCall: IrFunctionAccessExpression? = null + var tmpDispatchReceiver: IrVariable? = null + var tmpExtensionReceiver: IrVariable? = null + val irCall = statementGenerator.generateCallReceiver( ktCallableReference, resolvedDescriptor, @@ -202,8 +219,28 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St context.callToSubstitutedDescriptorMap[irAdapteeCallInner] = resolvedDescriptor - irAdapteeCallInner.dispatchReceiver = dispatchReceiverValue?.load() - irAdapteeCallInner.extensionReceiver = extensionReceiverValue?.load() + val irDispatchReceiver = dispatchReceiverValue?.load() + val irExtensionReceiver = extensionReceiverValue?.load() + + if (irDispatchReceiver != null) { + if (irDispatchReceiver.isSafeToUseWithoutCopying()) { + irAdapteeCallInner.dispatchReceiver = irDispatchReceiver + } else { + val irVariable = statementGenerator.scope.createTemporaryVariable(irDispatchReceiver, "this") + irAdapteeCallInner.dispatchReceiver = IrGetValueImpl(startOffset, endOffset, irVariable.symbol) + tmpDispatchReceiver = irVariable + } + } + + if (irExtensionReceiver != null) { + if (irExtensionReceiver.isSafeToUseWithoutCopying()) { + irAdapteeCallInner.extensionReceiver = irExtensionReceiver + } else { + val irVariable = statementGenerator.scope.createTemporaryVariable(irExtensionReceiver, "receiver") + irAdapteeCallInner.extensionReceiver = IrGetValueImpl(startOffset, endOffset, irVariable.symbol) + tmpExtensionReceiver = irVariable + } + } irAdapteeCallInner.putTypeArguments(callBuilder.typeArguments) { it.toIrType() } @@ -214,9 +251,18 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St irAdapteeCallInner } - return Pair(irCall, irAdapteeCall!!) + return AdapteeCall(irCall, irAdapteeCall!!, tmpDispatchReceiver, tmpExtensionReceiver) } + private fun IrExpression.isSafeToUseWithoutCopying() = + this is IrGetObjectValue || + this is IrGetEnumValue || + this is IrConst<*> || + this is IrGetValue && symbol.isBound && symbol.owner.isImmutable() + + private fun IrValueDeclaration.isImmutable() = + this is IrValueParameter || this is IrVariable && !this.isVar + private fun putAdaptedValueArguments( startOffset: Int, endOffset: Int, @@ -294,7 +340,7 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St ktExpectedReturnType: KotlinType ): IrSimpleFunction { val adapterFunctionDescriptor = WrappedSimpleFunctionDescriptor() - val adapterOrigin = IrDeclarationOrigin.DEFINED // TODO special declaration origin for callable reference adapter? + return context.symbolTable.declareSimpleFunction( startOffset, endOffset, adapterOrigin, adapterFunctionDescriptor diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.fir.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.fir.txt new file mode 100644 index 00000000000..83d08684c32 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.fir.txt @@ -0,0 +1,83 @@ +FILE fqName: fileName:/constructorWithAdaptedArguments.kt + FUN name:use visibility:public modality:FINAL <> (fn:kotlin.Function1) returnType:kotlin.Any + VALUE_PARAMETER name:fn index:0 type:kotlin.Function1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun use (fn: kotlin.Function1): kotlin.Any declared in ' + CALL 'public abstract fun invoke (p1: kotlin.Int): kotlin.Any [operator] declared in kotlin.Function1' type=kotlin.Any origin=null + $this: GET_VAR 'fn: kotlin.Function1 declared in .use' type=kotlin.Function1 origin=null + p1: CONST Int type=kotlin.Int value=42 + CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C + CONSTRUCTOR visibility:public <> (xs:kotlin.IntArray) returnType:.C [primary] + VALUE_PARAMETER name:xs index:0 type:kotlin.IntArray + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]' + 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: 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: 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: type:kotlin.Any + CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Outer + CONSTRUCTOR visibility:public <> () returnType:.Outer [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any]' + CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Outer.Inner + CONSTRUCTOR visibility:public <> (xs:kotlin.IntArray) returnType:.Outer.Inner [primary] + VALUE_PARAMETER name:xs index:0 type:kotlin.IntArray + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]' + 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: 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: 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: type:kotlin.Any + 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: 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: 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: type:kotlin.Any + FUN name:testConstructor visibility:public modality:FINAL <> () returnType:IrErrorType + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testConstructor (): IrErrorType declared in ' + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUNCTION_REFERENCE 'public constructor (xs: kotlin.IntArray) [primary] declared in .C' type=kotlin.reflect.KFunction1.C> origin=null + FUN name:testInnerClassConstructor visibility:public modality:FINAL <> (outer:.Outer) returnType:IrErrorType + VALUE_PARAMETER name:outer index:0 type:.Outer + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInnerClassConstructor (outer: .Outer): IrErrorType declared in ' + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUNCTION_REFERENCE 'public constructor (xs: kotlin.IntArray) [primary] declared in .Outer.Inner' type=kotlin.reflect.KFunction1.Outer.Inner> origin=null + FUN name:testInnerClassConstructorCapturingOuter visibility:public modality:FINAL <> () returnType:IrErrorType + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInnerClassConstructorCapturingOuter (): IrErrorType declared in ' + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUNCTION_REFERENCE 'public constructor (xs: kotlin.IntArray) [primary] declared in .Outer.Inner' type=kotlin.reflect.KFunction1.Outer.Inner> origin=null diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt new file mode 100644 index 00000000000..765d6d88444 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt @@ -0,0 +1,15 @@ +// !LANGUAGE: +NewInference, +FunctionReferenceWithDefaultValueAsOtherType + +fun use(fn: (Int) -> Any) = fn(42) + +class C(vararg xs: Int) + +class Outer { + inner class Inner(vararg xs: Int) +} + +fun testConstructor() = use(::C) + +fun testInnerClassConstructor(outer: Outer) = use(outer::Inner) + +fun testInnerClassConstructorCapturingOuter() = use(Outer()::Inner) \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.txt b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.txt new file mode 100644 index 00000000000..c520a16c84a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.txt @@ -0,0 +1,112 @@ +FILE fqName: fileName:/constructorWithAdaptedArguments.kt + FUN name:use visibility:public modality:FINAL <> (fn:kotlin.Function1) returnType:kotlin.Any + VALUE_PARAMETER name:fn index:0 type:kotlin.Function1 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun use (fn: kotlin.Function1): kotlin.Any declared in ' + CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Any origin=INVOKE + $this: GET_VAR 'fn: kotlin.Function1 declared in .use' type=kotlin.Function1 origin=VARIABLE_AS_FUNCTION + p1: CONST Int type=kotlin.Int value=42 + CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C + CONSTRUCTOR visibility:public <> (xs:kotlin.IntArray) returnType:.C [primary] + VALUE_PARAMETER name:xs index:0 type:kotlin.IntArray varargElementType:kotlin.Int [vararg] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]' + 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: 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: 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: type:kotlin.Any + CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Outer + CONSTRUCTOR visibility:public <> () returnType:.Outer [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any]' + CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Outer.Inner + CONSTRUCTOR visibility:public <> ($this:.Outer, xs:kotlin.IntArray) returnType:.Outer.Inner [primary] + $outer: VALUE_PARAMETER name: type:.Outer + VALUE_PARAMETER name:xs index:0 type:kotlin.IntArray varargElementType:kotlin.Int [vararg] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]' + 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: 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: 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: type:kotlin.Any + 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: 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: 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: type:kotlin.Any + FUN name:testConstructor visibility:public modality:FINAL <> () returnType:kotlin.Any + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testConstructor (): kotlin.Any declared in ' + CALL 'public final fun use (fn: kotlin.Function1): kotlin.Any declared in ' type=kotlin.Any origin=null + fn: BLOCK type=kotlin.reflect.KFunction1.C> origin=null + FUN name: visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:.C + VALUE_PARAMETER name:p0 index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (p0: kotlin.Int): .C declared in .testConstructor' + CONSTRUCTOR_CALL 'public constructor (vararg xs: kotlin.Int) [primary] declared in .C' type=.C origin=null + xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int + GET_VAR 'p0: kotlin.Int declared in .testConstructor.' type=kotlin.Int origin=null + FUNCTION_REFERENCE 'local final fun (p0: kotlin.Int): .C declared in .testConstructor' type=kotlin.reflect.KFunction1.C> origin=null + FUN name:testInnerClassConstructor visibility:public modality:FINAL <> (outer:.Outer) returnType:kotlin.Any + VALUE_PARAMETER name:outer index:0 type:.Outer + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInnerClassConstructor (outer: .Outer): kotlin.Any declared in ' + CALL 'public final fun use (fn: kotlin.Function1): kotlin.Any declared in ' type=kotlin.Any origin=null + fn: BLOCK type=kotlin.reflect.KFunction1.Outer.Inner> origin=null + FUN name: visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:.Outer.Inner + VALUE_PARAMETER name:p0 index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (p0: kotlin.Int): .Outer.Inner declared in .testInnerClassConstructor' + CONSTRUCTOR_CALL 'public constructor (vararg xs: kotlin.Int) [primary] declared in .Outer.Inner' type=.Outer.Inner origin=null + $outer: GET_VAR 'outer: .Outer declared in .testInnerClassConstructor' type=.Outer origin=null + xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int + GET_VAR 'p0: kotlin.Int declared in .testInnerClassConstructor.' type=kotlin.Int origin=null + FUNCTION_REFERENCE 'local final fun (p0: kotlin.Int): .Outer.Inner declared in .testInnerClassConstructor' type=kotlin.reflect.KFunction1.Outer.Inner> origin=null + FUN name:testInnerClassConstructorCapturingOuter visibility:public modality:FINAL <> () returnType:kotlin.Any + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInnerClassConstructorCapturingOuter (): kotlin.Any declared in ' + CALL 'public final fun use (fn: kotlin.Function1): kotlin.Any declared in ' type=kotlin.Any origin=null + fn: BLOCK type=kotlin.reflect.KFunction1.Outer.Inner> origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.Outer [val] + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Outer' type=.Outer origin=null + FUN name: visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:.Outer.Inner + VALUE_PARAMETER name:p0 index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (p0: kotlin.Int): .Outer.Inner declared in .testInnerClassConstructorCapturingOuter' + CONSTRUCTOR_CALL 'public constructor (vararg xs: kotlin.Int) [primary] declared in .Outer.Inner' type=.Outer.Inner origin=null + $outer: GET_VAR 'val tmp_0: .Outer [val] declared in .testInnerClassConstructorCapturingOuter' type=.Outer origin=null + xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int + GET_VAR 'p0: kotlin.Int declared in .testInnerClassConstructorCapturingOuter.' type=kotlin.Int origin=null + FUNCTION_REFERENCE 'local final fun (p0: kotlin.Int): .Outer.Inner declared in .testInnerClassConstructorCapturingOuter' type=kotlin.reflect.KFunction1.Outer.Inner> origin=null diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.fir.txt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.fir.txt new file mode 100644 index 00000000000..8e389b6ed43 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.fir.txt @@ -0,0 +1,62 @@ +FILE fqName: fileName:/withArgumentAdaptationAndReceiver.kt + FUN name:use visibility:public modality:FINAL <> (fn:kotlin.Function1) returnType:kotlin.Unit + VALUE_PARAMETER name:fn index:0 type:kotlin.Function1 + BLOCK_BODY + CALL 'public abstract fun invoke (p1: kotlin.Int): kotlin.Unit [operator] declared in kotlin.Function1' type=kotlin.Unit origin=null + $this: GET_VAR 'fn: kotlin.Function1 declared in .use' type=kotlin.Function1 origin=null + p1: CONST Int type=kotlin.Int value=1 + CLASS CLASS name:Host modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Host + CONSTRUCTOR visibility:public <> () returnType:.Host [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN name:withVararg visibility:public modality:FINAL <> ($this:.Host, xs:kotlin.IntArray) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.Host + VALUE_PARAMETER name:xs index:0 type:kotlin.IntArray + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun withVararg (xs: kotlin.IntArray): kotlin.String declared in .Host' + CONST String type=kotlin.String value="" + FUN name:testImplicitThis visibility:public modality:FINAL <> ($this:.Host) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Host + BLOCK_BODY + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUNCTION_REFERENCE 'public final fun withVararg (xs: kotlin.IntArray): kotlin.String declared in .Host' type=kotlin.reflect.KFunction1 origin=null + FUN name:testBoundReceiverLocalVal visibility:public modality:FINAL <> ($this:.Host) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Host + BLOCK_BODY + VAR name:h type:.Host [val] + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Host' type=.Host origin=null + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUNCTION_REFERENCE 'public final fun withVararg (xs: kotlin.IntArray): kotlin.String declared in .Host' type=kotlin.reflect.KFunction1 origin=null + FUN name:testBoundReceiverLocalVar visibility:public modality:FINAL <> ($this:.Host) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Host + BLOCK_BODY + VAR name:h type:.Host [var] + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Host' type=.Host origin=null + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUNCTION_REFERENCE 'public final fun withVararg (xs: kotlin.IntArray): kotlin.String declared in .Host' type=kotlin.reflect.KFunction1 origin=null + FUN name:testBoundReceiverParameter visibility:public modality:FINAL <> ($this:.Host, h:.Host) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Host + VALUE_PARAMETER name:h index:0 type:.Host + BLOCK_BODY + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUNCTION_REFERENCE 'public final fun withVararg (xs: kotlin.IntArray): kotlin.String declared in .Host' type=kotlin.reflect.KFunction1 origin=null + FUN name:testBoundReceiverExpression visibility:public modality:FINAL <> ($this:.Host) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Host + BLOCK_BODY + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUNCTION_REFERENCE 'public final fun withVararg (xs: kotlin.IntArray): kotlin.String declared in .Host' type=kotlin.reflect.KFunction1 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: 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: 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: type:kotlin.Any diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt new file mode 100644 index 00000000000..b134db8cf1f --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt @@ -0,0 +1,29 @@ +// !LANGUAGE: +NewInference, +FunctionReferenceWithDefaultValueAsOtherType + +fun use(fn: (Int) -> Unit) { fn(1) } + +class Host { + fun withVararg(vararg xs: Int) = "" + + fun testImplicitThis() { + use(::withVararg) + } + + fun testBoundReceiverLocalVal() { + val h = Host() + use(h::withVararg) + } + + fun testBoundReceiverLocalVar() { + var h = Host() + use(h::withVararg) + } + + fun testBoundReceiverParameter(h: Host) { + use(h::withVararg) + } + + fun testBoundReceiverExpression() { + use(Host()::withVararg) + } +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.txt b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.txt new file mode 100644 index 00000000000..605d74a14bd --- /dev/null +++ b/compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.txt @@ -0,0 +1,111 @@ +FILE fqName: fileName:/withArgumentAdaptationAndReceiver.kt + FUN name:use visibility:public modality:FINAL <> (fn:kotlin.Function1) returnType:kotlin.Unit + VALUE_PARAMETER name:fn index:0 type:kotlin.Function1 + BLOCK_BODY + CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Unit origin=INVOKE + $this: GET_VAR 'fn: kotlin.Function1 declared in .use' type=kotlin.Function1 origin=VARIABLE_AS_FUNCTION + p1: CONST Int type=kotlin.Int value=1 + CLASS CLASS name:Host modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Host + CONSTRUCTOR visibility:public <> () returnType:.Host [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN name:withVararg visibility:public modality:FINAL <> ($this:.Host, xs:kotlin.IntArray) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.Host + VALUE_PARAMETER name:xs index:0 type:kotlin.IntArray varargElementType:kotlin.Int [vararg] + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun withVararg (vararg xs: kotlin.Int): kotlin.String declared in .Host' + CONST String type=kotlin.String value="" + FUN name:testImplicitThis visibility:public modality:FINAL <> ($this:.Host) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Host + BLOCK_BODY + CALL 'public final fun use (fn: kotlin.Function1): kotlin.Unit declared in ' type=kotlin.Unit origin=null + fn: BLOCK type=kotlin.reflect.KFunction1 origin=null + FUN name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit + VALUE_PARAMETER name:p0 index:0 type:kotlin.Int + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public final fun withVararg (vararg xs: kotlin.Int): kotlin.String declared in .Host' type=kotlin.String origin=null + $this: GET_VAR ': .Host declared in .Host.testImplicitThis' type=.Host origin=null + xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int + GET_VAR 'p0: kotlin.Int declared in .Host.testImplicitThis.withVararg' type=kotlin.Int origin=null + FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in .Host.testImplicitThis' type=kotlin.reflect.KFunction1 origin=null + FUN name:testBoundReceiverLocalVal visibility:public modality:FINAL <> ($this:.Host) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Host + BLOCK_BODY + VAR name:h type:.Host [val] + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Host' type=.Host origin=null + CALL 'public final fun use (fn: kotlin.Function1): kotlin.Unit declared in ' type=kotlin.Unit origin=null + fn: BLOCK type=kotlin.reflect.KFunction1 origin=null + FUN name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit + VALUE_PARAMETER name:p0 index:0 type:kotlin.Int + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public final fun withVararg (vararg xs: kotlin.Int): kotlin.String declared in .Host' type=kotlin.String origin=null + $this: GET_VAR 'val h: .Host [val] declared in .Host.testBoundReceiverLocalVal' type=.Host origin=null + xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int + GET_VAR 'p0: kotlin.Int declared in .Host.testBoundReceiverLocalVal.withVararg' type=kotlin.Int origin=null + FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in .Host.testBoundReceiverLocalVal' type=kotlin.reflect.KFunction1 origin=null + FUN name:testBoundReceiverLocalVar visibility:public modality:FINAL <> ($this:.Host) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Host + BLOCK_BODY + VAR name:h type:.Host [var] + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Host' type=.Host origin=null + CALL 'public final fun use (fn: kotlin.Function1): kotlin.Unit declared in ' type=kotlin.Unit origin=null + fn: BLOCK type=kotlin.reflect.KFunction1 origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.Host [val] + GET_VAR 'var h: .Host [var] declared in .Host.testBoundReceiverLocalVar' type=.Host origin=null + FUN name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit + VALUE_PARAMETER name:p0 index:0 type:kotlin.Int + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public final fun withVararg (vararg xs: kotlin.Int): kotlin.String declared in .Host' type=kotlin.String origin=null + $this: GET_VAR 'val tmp_0: .Host [val] declared in .Host.testBoundReceiverLocalVar' type=.Host origin=null + xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int + GET_VAR 'p0: kotlin.Int declared in .Host.testBoundReceiverLocalVar.withVararg' type=kotlin.Int origin=null + FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in .Host.testBoundReceiverLocalVar' type=kotlin.reflect.KFunction1 origin=null + FUN name:testBoundReceiverParameter visibility:public modality:FINAL <> ($this:.Host, h:.Host) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Host + VALUE_PARAMETER name:h index:0 type:.Host + BLOCK_BODY + CALL 'public final fun use (fn: kotlin.Function1): kotlin.Unit declared in ' type=kotlin.Unit origin=null + fn: BLOCK type=kotlin.reflect.KFunction1 origin=null + FUN name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit + VALUE_PARAMETER name:p0 index:0 type:kotlin.Int + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public final fun withVararg (vararg xs: kotlin.Int): kotlin.String declared in .Host' type=kotlin.String origin=null + $this: GET_VAR 'h: .Host declared in .Host.testBoundReceiverParameter' type=.Host origin=null + xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int + GET_VAR 'p0: kotlin.Int declared in .Host.testBoundReceiverParameter.withVararg' type=kotlin.Int origin=null + FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in .Host.testBoundReceiverParameter' type=kotlin.reflect.KFunction1 origin=null + FUN name:testBoundReceiverExpression visibility:public modality:FINAL <> ($this:.Host) returnType:kotlin.Unit + $this: VALUE_PARAMETER name: type:.Host + BLOCK_BODY + CALL 'public final fun use (fn: kotlin.Function1): kotlin.Unit declared in ' type=kotlin.Unit origin=null + fn: BLOCK type=kotlin.reflect.KFunction1 origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:.Host [val] + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .Host' type=.Host origin=null + FUN name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit + VALUE_PARAMETER name:p0 index:0 type:kotlin.Int + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public final fun withVararg (vararg xs: kotlin.Int): kotlin.String declared in .Host' type=kotlin.String origin=null + $this: GET_VAR 'val tmp_1: .Host [val] declared in .Host.testBoundReceiverExpression' type=.Host origin=null + xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int + GET_VAR 'p0: kotlin.Int declared in .Host.testBoundReceiverExpression.withVararg' type=kotlin.Int origin=null + FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in .Host.testBoundReceiverExpression' type=kotlin.reflect.KFunction1 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: 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: 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: type:kotlin.Any diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index a05961c1a9b..e6f9bc00f14 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1348,6 +1348,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/callableReferences"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("constructorWithAdaptedArguments.kt") + public void testConstructorWithAdaptedArguments() throws Exception { + runTest("compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt"); + } + @TestMetadata("genericMember.kt") public void testGenericMember() throws Exception { runTest("compiler/testData/ir/irText/expressions/callableReferences/genericMember.kt"); @@ -1368,6 +1373,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/expressions/callableReferences/withAdaptedArguments.kt"); } + @TestMetadata("withArgumentAdaptationAndReceiver.kt") + public void testWithArgumentAdaptationAndReceiver() throws Exception { + runTest("compiler/testData/ir/irText/expressions/callableReferences/withArgumentAdaptationAndReceiver.kt"); + } + @TestMetadata("withVarargViewedAsArray.kt") public void testWithVarargViewedAsArray() throws Exception { runTest("compiler/testData/ir/irText/expressions/callableReferences/withVarargViewedAsArray.kt");