KT-36024 Generate adapted callable references as lambdas

Make sure both JVM and JVM_IR use the same information to determine
whether a callable reference requires argument adaptation.
This commit is contained in:
Dmitry Petrov
2020-03-19 14:03:01 +03:00
committed by Alexander Udalov
parent ddf7f53118
commit d1c5a42124
29 changed files with 478 additions and 183 deletions
@@ -74,7 +74,9 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
protected final Type asmType;
protected final int visibilityFlag;
private final boolean shouldHaveBoundReferenceReceiver;
private final boolean isRegularFunctionReference;
private final boolean isOptimizedFunctionReference;
private final boolean isAdaptedFunctionReference;
private Method constructor;
protected Type superClassAsmType;
@@ -125,9 +127,17 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
assert closure != null : "Closure must be calculated for class: " + classDescriptor;
this.shouldHaveBoundReferenceReceiver = CallableReferenceUtilKt.isForBoundCallableReference(closure);
ClassifierDescriptor superClassDescriptor = superClassType.getConstructor().getDeclarationDescriptor();
this.isRegularFunctionReference =
functionReferenceTarget != null &&
superClassDescriptor == state.getJvmRuntimeTypes().getFunctionReference();
this.isOptimizedFunctionReference =
functionReferenceTarget != null &&
superClassType.getConstructor().getDeclarationDescriptor() == state.getJvmRuntimeTypes().getFunctionReferenceImpl();
superClassDescriptor == state.getJvmRuntimeTypes().getFunctionReferenceImpl();
this.isAdaptedFunctionReference =
functionReferenceTarget != null &&
superClassDescriptor == state.getJvmRuntimeTypes().getLambda();
this.asmType = typeMapper.mapClass(classDescriptor);
@@ -189,15 +199,29 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
protected void generateClosureBody() {
functionCodegen.generateMethod(JvmDeclarationOriginKt.OtherOrigin(element, funDescriptor), funDescriptor, strategy);
if (functionReferenceTarget != null && !isOptimizedFunctionReference) {
if (isRegularFunctionReference) {
generateFunctionReferenceMethods(functionReferenceTarget);
}
if (shouldHaveBoundReferenceReceiver && isAdaptedFunctionReference) {
generateBoundAdaptedCallableReferenceReceiverField();
}
functionCodegen.generateDefaultIfNeeded(
context.intoFunction(funDescriptor), funDescriptor, context.getContextKind(), DefaultParameterValueLoader.DEFAULT, null
);
}
private void generateBoundAdaptedCallableReferenceReceiverField() {
v.newField(
JvmDeclarationOriginKt.OtherOrigin(element, funDescriptor),
ACC_PRIVATE,
BOUND_REFERENCE_RECEIVER,
OBJECT_TYPE.getDescriptor(),
null, null
);
}
protected void generateBridges() {
FunctionDescriptor erasedInterfaceFunction;
if (samType == null) {
@@ -500,11 +524,12 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
List<Type> superCtorArgTypes = new ArrayList<>();
if (superClassAsmType.equals(LAMBDA) || superClassAsmType.equals(FUNCTION_REFERENCE) ||
superClassAsmType.equals(FUNCTION_REFERENCE_IMPL) ||
CoroutineCodegenUtilKt.isCoroutineSuperClass(state.getLanguageVersionSettings(), superClassAsmType.getInternalName())) {
CoroutineCodegenUtilKt.isCoroutineSuperClass(state.getLanguageVersionSettings(), superClassAsmType.getInternalName())
) {
int arity = calculateArity();
iv.iconst(arity);
superCtorArgTypes.add(Type.INT_TYPE);
if (shouldHaveBoundReferenceReceiver) {
if (shouldHaveBoundReferenceReceiver && !isAdaptedFunctionReference) {
CallableReferenceUtilKt.loadBoundReferenceReceiverParameter(
iv, boundReceiverParameterIndex, boundReceiverType, boundReceiverKotlinType
);
@@ -533,6 +558,19 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
Type.getMethodDescriptor(Type.VOID_TYPE, superCtorArgTypes.toArray(new Type[0])), false
);
// Bound adapted function references store receiver in a separate field.
if (shouldHaveBoundReferenceReceiver && isAdaptedFunctionReference) {
iv.load(0, superClassAsmType);
CallableReferenceUtilKt.loadBoundReferenceReceiverParameter(
iv, boundReceiverParameterIndex, boundReceiverType, boundReceiverKotlinType
);
iv.putfield(
asmType.getInternalName(),
BOUND_REFERENCE_RECEIVER,
OBJECT_TYPE.getDescriptor()
);
}
iv.visitInsn(RETURN);
FunctionCodegen.endVisit(iv, "constructor", element);
@@ -43,9 +43,8 @@ class JvmRuntimeTypes(
private fun propertyClasses(prefix: String, suffix: String): Lazy<List<ClassDescriptor>> =
lazy { (0..2).map { i -> createClass(kotlinJvmInternalPackage, prefix + i + suffix) } }
private val lambda: ClassDescriptor by internal("Lambda")
private val functionReference: ClassDescriptor by internal("FunctionReference")
val lambda: ClassDescriptor by internal("Lambda")
val functionReference: ClassDescriptor by internal("FunctionReference")
val functionReferenceImpl: ClassDescriptor by internal("FunctionReferenceImpl")
private val localVariableReference: ClassDescriptor by internal("LocalVariableReference")
@@ -135,7 +134,8 @@ class JvmRuntimeTypes(
fun getSupertypesForFunctionReference(
referencedFunction: FunctionDescriptor,
anonymousFunctionDescriptor: AnonymousFunctionDescriptor,
isBound: Boolean
isBound: Boolean,
isAdaptedCallableReference: Boolean
): Collection<KotlinType> {
val receivers = computeExpectedNumberOfReceivers(referencedFunction, isBound)
@@ -151,7 +151,11 @@ class JvmRuntimeTypes(
)
val suspendFunctionType = if (referencedFunction.isSuspend) suspendFunctionInterface?.defaultType else null
val superClass = if (generateOptimizedCallableReferenceSuperClasses) functionReferenceImpl else functionReference
val superClass = when {
isAdaptedCallableReference -> lambda
generateOptimizedCallableReferenceSuperClasses -> functionReferenceImpl
else -> functionReference
}
return listOfNotNull(superClass.defaultType, functionType, suspendFunctionType)
}
@@ -172,4 +176,4 @@ class JvmRuntimeTypes(
return classes[arity].defaultType
}
}
}
@@ -16,6 +16,7 @@ import kotlin.collections.CollectionsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.FunctionTypesKt;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.builtins.ReflectionTypes;
import org.jetbrains.kotlin.cfg.WhenChecker;
import org.jetbrains.kotlin.codegen.*;
@@ -357,6 +358,28 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
classStack.pop();
}
private boolean isAdaptedCallableReference(
@NotNull KtCallableReferenceExpression expression,
@NotNull ResolvedCall<?> resolvedCall
) {
CallableDescriptor resultingDescriptor = resolvedCall.getResultingDescriptor();
if (!(resultingDescriptor instanceof FunctionDescriptor)) return false;
FunctionDescriptor functionDescriptor = (FunctionDescriptor) resultingDescriptor;
// Callable reference is adapted if:
// - adapter arguments mapping is present in value arguments of corresponding resolved call;
// - return type is not Unit, and expected return type is Unit.
if (!resolvedCall.getValueArguments().isEmpty()) return true;
KotlinType callableReferenceType = bindingContext.getType(expression);
assert callableReferenceType != null : "No type for callable reference: " + expression.getText();
KotlinType callableReferenceReturnType = CollectionsKt.last(callableReferenceType.getArguments()).getType();
KotlinType functionReturnType = functionDescriptor.getReturnType();
assert functionReturnType != null : "No return type for function: " + functionDescriptor;
return KotlinBuiltIns.isUnit(callableReferenceReturnType) && !KotlinBuiltIns.isUnit(functionReturnType);
}
@Override
public void visitCallableReferenceExpression(@NotNull KtCallableReferenceExpression expression) {
ResolvedCall<?> referencedFunction = CallUtilKt.getResolvedCall(expression.getCallableReference(), bindingContext);
@@ -380,7 +403,8 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
if (callableDescriptor == null) return;
supertypes = runtimeTypes.getSupertypesForFunctionReference(
(FunctionDescriptor) target, (AnonymousFunctionDescriptor) callableDescriptor, receiverType != null
(FunctionDescriptor) target, (AnonymousFunctionDescriptor) callableDescriptor, receiverType != null,
isAdaptedCallableReference(expression, referencedFunction)
);
}
else if (target instanceof PropertyDescriptor) {
@@ -1983,6 +1983,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/callableReference/nested.kt");
}
@TestMetadata("noReflectionForAdaptedCallableReferences.kt")
public void testNoReflectionForAdaptedCallableReferences() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/noReflectionForAdaptedCallableReferences.kt");
}
@TestMetadata("optimizedSuperclasses_after.kt")
public void testOptimizedSuperclasses_after() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/optimizedSuperclasses_after.kt");
@@ -1395,6 +1395,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
runTest("compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt");
}
@TestMetadata("adaptedWithCoercionToUnit.kt")
public void testAdaptedWithCoercionToUnit() throws Exception {
runTest("compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt");
}
public void testAllFilesPresentInCallableReferences() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/callableReferences"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@@ -7,10 +7,7 @@ package org.jetbrains.kotlin.resolve.calls.tower
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.createFunctionType
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.impl.FunctionDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.ReceiverParameterDescriptorImpl
import org.jetbrains.kotlin.psi.KtElement
@@ -41,6 +38,7 @@ import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.expressions.CoercionStrategy
import org.jetbrains.kotlin.types.expressions.DoubleColonExpressionResolver
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.createTypeInfo
@@ -396,7 +394,6 @@ class ResolvedAtomCompleter(
callableReferenceAdaptation: CallableReferenceAdaptation?
) {
if (callableReferenceAdaptation == null) return
val callElement = resolvedCall.call.callElement
val isUnboundReference = resolvedCall.dispatchReceiver is TransientReceiver
@@ -409,34 +406,55 @@ class ResolvedAtomCompleter(
)
}
// We should record argument mapping only if callable reference requires adaptation:
// - argument mapping is non-trivial: any of the arguments were mapped as defaults or vararg elements;
// - result should be coerced.
var hasNonTrivialMapping = false
val mappedArguments = ArrayList<Pair<ValueParameterDescriptor, ResolvedValueArgument>>()
for ((valueParameter, resolvedCallArgument) in callableReferenceAdaptation.mappedArguments) {
resolvedCall.recordValueArgument(
valueParameter,
when (resolvedCallArgument) {
ResolvedCallArgument.DefaultArgument ->
DefaultValueArgument.DEFAULT
is ResolvedCallArgument.SimpleArgument -> {
val valueArgument = makeFakeValueArgument(resolvedCallArgument.callArgument)
if (valueParameter.isVararg)
VarargValueArgument(
listOf(
FakeImplicitSpreadValueArgumentForCallableReferenceImpl(callElement, valueArgument)
)
)
else
ExpressionValueArgument(valueArgument)
}
is ResolvedCallArgument.VarargArgument ->
VarargValueArgument(
resolvedCallArgument.arguments.map {
makeFakeValueArgument(it)
}
)
val resolvedValueArgument = when (resolvedCallArgument) {
ResolvedCallArgument.DefaultArgument -> {
hasNonTrivialMapping = true
DefaultValueArgument.DEFAULT
}
)
is ResolvedCallArgument.SimpleArgument -> {
val valueArgument = makeFakeValueArgument(resolvedCallArgument.callArgument)
if (valueParameter.isVararg)
VarargValueArgument(
listOf(
FakeImplicitSpreadValueArgumentForCallableReferenceImpl(callElement, valueArgument)
)
)
else
ExpressionValueArgument(valueArgument)
}
is ResolvedCallArgument.VarargArgument -> {
hasNonTrivialMapping = true
VarargValueArgument(
resolvedCallArgument.arguments.map {
makeFakeValueArgument(it)
}
)
}
}
mappedArguments.add(valueParameter to resolvedValueArgument)
}
if (hasNonTrivialMapping || isCallableReferenceWithCoercion(resolvedCall, callableReferenceAdaptation.coercionStrategy)) {
for ((valueParameter, resolvedValueArgument) in mappedArguments) {
resolvedCall.recordValueArgument(valueParameter, resolvedValueArgument)
}
}
}
private fun isCallableReferenceWithCoercion(
resolvedCall: ResolvedCall<CallableDescriptor>,
coercionStrategy: CoercionStrategy
): Boolean =
when (coercionStrategy) {
CoercionStrategy.NO_COERCION -> false
CoercionStrategy.COERCION_TO_UNIT -> !resolvedCall.resultingDescriptor.returnType!!.isUnit()
}
private fun completeCollectionLiteralCalls(collectionLiteralArgument: ResolvedCollectionLiteralAtom) {
val psiCallArgument = collectionLiteralArgument.atom.psiCallArgument as CollectionLiteralKotlinCallArgumentImpl
val context = psiCallArgument.outerCallContext
@@ -41,7 +41,7 @@ import org.jetbrains.kotlin.resolve.calls.model.*
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.expressions.DoubleColonLHS
import org.jetbrains.kotlin.utils.addIfNotNull
import org.jetbrains.kotlin.utils.SmartList
class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : StatementGeneratorExtension(statementGenerator) {
@@ -72,13 +72,10 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
val callBuilder = unwrapCallableDescriptorAndTypeArguments(resolvedCall, context.extensions.samConversion)
if (resolvedCall.valueArguments.isNotEmpty()) {
val adaptedCallableReference = generateAdaptedCallableReference(ktCallableReference, callBuilder)
if (adaptedCallableReference.hasResultAdaptation ||
!isTrivialArgumentAdaptation(adaptedCallableReference.irAdapteeCall)
) {
return adaptedCallableReference.irReferenceExpression
}
if (resolvedCall.valueArguments.isNotEmpty() ||
requiresCoercionToUnit(resolvedDescriptor, getTypeInferredByFrontendOrFail(ktCallableReference))
) {
return generateAdaptedCallableReference(ktCallableReference, callBuilder)
}
return statementGenerator.generateCallReceiver(
@@ -99,27 +96,15 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
}
}
private fun isTrivialArgumentAdaptation(irAdapteeCall: IrFunctionAccessExpression): Boolean {
for (i in 0 until irAdapteeCall.valueArgumentsCount) {
val irValueArgument = irAdapteeCall.getValueArgument(i) ?: return false
if (irValueArgument is IrVararg) {
val irVarargElements = irValueArgument.elements
if (irVarargElements.size != 1 || irVarargElements[0] !is IrSpreadElement) return false
}
}
return true
private fun requiresCoercionToUnit(descriptor: CallableDescriptor, callableReferenceType: KotlinType): Boolean {
val ktExpectedReturnType = callableReferenceType.arguments.last().type
return KotlinBuiltIns.isUnit(ktExpectedReturnType) && !KotlinBuiltIns.isUnit(descriptor.returnType!!)
}
private class AdaptedCallableReference(
val irReferenceExpression: IrExpression,
val irAdapteeCall: IrFunctionAccessExpression,
val hasResultAdaptation: Boolean
)
private fun generateAdaptedCallableReference(
ktCallableReference: KtCallableReferenceExpression,
callBuilder: CallBuilder
): AdaptedCallableReference {
): IrExpressionBase {
val adapteeDescriptor = callBuilder.descriptor
if (adapteeDescriptor !is FunctionDescriptor) {
throw AssertionError("Function descriptor expected in adapted callable reference: $adapteeDescriptor")
@@ -140,10 +125,6 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
val irAdapterFun = createAdapterFun(startOffset, endOffset, adapteeDescriptor, ktExpectedParameterTypes, ktExpectedReturnType)
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))
@@ -152,33 +133,27 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
statements.add(IrReturnImpl(startOffset, endOffset, context.irBuiltIns.nothingType, irAdapterFun.symbol, irCall))
}
val irBlock = IrBlockImpl(startOffset, endOffset, irFunctionalType).apply {
statements.addIfNotNull(tmpDispatchReceiver)
statements.addIfNotNull(tmpExtensionReceiver)
statements.add(irAdapterFun)
statements.add(
IrFunctionReferenceImpl(
startOffset, endOffset,
irFunctionalType,
irAdapterFun.symbol,
typeArgumentsCount = 0,
valueArgumentsCount = irAdapterFun.valueParameters.size,
reflectionTarget = null
)
val irFunExpr = IrFunctionExpressionImpl(
startOffset, endOffset,
irFunctionalType,
irAdapterFun,
IrStatementOrigin.LAMBDA
)
return if (adapteeCall.tmpReceivers.isEmpty()) {
irFunExpr
} else {
IrBlockImpl(
startOffset, endOffset, irFunctionalType,
origin = null,
statements = adapteeCall.tmpReceivers + irFunExpr
)
}
return AdaptedCallableReference(
irBlock, irAdapteeCallInner,
KotlinBuiltIns.isUnit(ktExpectedReturnType) && !KotlinBuiltIns.isUnit(adapteeDescriptor.returnType!!)
)
}
private class AdapteeCall(
val callExpression: IrExpression,
val innerCallExpression: IrFunctionAccessExpression,
val tmpDispatchReceiver: IrVariable?,
val tmpExtensionReceiver: IrVariable?
val tmpReceivers: List<IrVariable>
)
private fun createAdapteeCall(
@@ -192,9 +167,7 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
val resolvedCall = callBuilder.original
val resolvedDescriptor = resolvedCall.resultingDescriptor
var irAdapteeCall: IrFunctionAccessExpression? = null
var tmpDispatchReceiver: IrVariable? = null
var tmpExtensionReceiver: IrVariable? = null
val tmpReceivers = SmartList<IrVariable>()
val irCall = statementGenerator.generateCallReceiver(
ktCallableReference,
@@ -228,7 +201,7 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
} else {
val irVariable = statementGenerator.scope.createTemporaryVariable(irDispatchReceiver, "this")
irAdapteeCallInner.dispatchReceiver = IrGetValueImpl(startOffset, endOffset, irVariable.symbol)
tmpDispatchReceiver = irVariable
tmpReceivers.add(irVariable)
}
}
@@ -238,7 +211,7 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
} else {
val irVariable = statementGenerator.scope.createTemporaryVariable(irExtensionReceiver, "receiver")
irAdapteeCallInner.extensionReceiver = IrGetValueImpl(startOffset, endOffset, irVariable.symbol)
tmpExtensionReceiver = irVariable
tmpReceivers.add(irVariable)
}
}
@@ -246,12 +219,10 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
putAdaptedValueArguments(startOffset, endOffset, irAdapteeCallInner, irAdapterFun, resolvedCall)
irAdapteeCall = irAdapteeCallInner
irAdapteeCallInner
}
return AdapteeCall(irCall, irAdapteeCall!!, tmpDispatchReceiver, tmpExtensionReceiver)
return AdapteeCall(irCall, tmpReceivers)
}
private fun IrExpression.isSafeToUseWithoutCopying() =
@@ -271,10 +242,6 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
resolvedCall: ResolvedCall<*>
) {
val adaptedArguments = resolvedCall.valueArguments
if (adaptedArguments.isEmpty()) {
throw AssertionError("Callable reference with adapted arguments expected: ${resolvedCall.call.callElement.text}")
}
var shift = 0
if (resolvedCall.dispatchReceiver is TransientReceiver) {
// Unbound callable reference 'A::foo', receiver is passed as a first parameter
@@ -309,13 +276,16 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
is DefaultValueArgument ->
null
is VarargValueArgument ->
IrVarargImpl(
startOffset, endOffset,
valueParameter.type.toIrType(), valueParameter.varargElementType!!.toIrType(),
resolvedValueArgument.arguments.map {
adaptValueArgument(startOffset, endOffset, it, irAdapterFun, shift)
}
)
if (resolvedValueArgument.arguments.isEmpty())
null
else
IrVarargImpl(
startOffset, endOffset,
valueParameter.type.toIrType(), valueParameter.varargElementType!!.toIrType(),
resolvedValueArgument.arguments.map {
adaptValueArgument(startOffset, endOffset, it, irAdapterFun, shift)
}
)
is ExpressionValueArgument -> {
val valueArgument = resolvedValueArgument.valueArgument!!
@@ -315,6 +315,12 @@ class CallableReferencesCandidateFactory(
mappedArguments[valueParameter] = ResolvedCallArgument.VarargArgument(varargElements)
}
for (valueParameter in descriptor.valueParameters) {
if (valueParameter.isVararg && valueParameter !in mappedArguments) {
mappedArguments[valueParameter] = ResolvedCallArgument.VarargArgument(emptyList())
}
}
// lower(Unit!) = Unit
val returnExpectedType = inputOutputTypes.outputType
@@ -0,0 +1,38 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
import kotlin.reflect.KCallable
fun checkUnit(label: String, fn: () -> Unit) {
if (fn is KCallable<*>) {
throw AssertionError("$label is KCallable, ${fn::class.java.simpleName}")
}
}
fun checkAny(label: String, fn: () -> Any) {
if (fn is KCallable<*>) {
throw AssertionError("$label is KCallable, ${fn::class.java.simpleName}")
}
}
fun withDefaults(a: Int = 1, b: Int = 2) {}
fun withVarargs(vararg xs: Int) {}
fun withCoercion() = 1
class CWithDefaults(x: Int = 1, y: Int = 2)
class CWithVarargs(vararg xs: Int)
fun box(): String {
checkUnit("::withDefaults", ::withDefaults)
checkUnit("::withVarargs", ::withVarargs)
checkUnit("::withCoercion", ::withCoercion)
checkAny("::CWithDefaults", ::CWithDefaults)
checkAny("::CWithVarargs", ::CWithVarargs)
// TODO KT-37604
// checkUnit("::CWithDefaults", ::CWithDefaults)
// checkUnit("::CWithVarargs", ::CWithVarargs)
return "OK"
}
@@ -44,7 +44,7 @@ FILE fqName:<root> fileName:/adaptedExtensionFunctions.kt
FUN name:testExtensionVararg visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun use (f: @[ExtensionFunctionType] kotlin.Function2<<root>.C, kotlin.Int, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
f: BLOCK type=kotlin.reflect.KFunction2<<root>.C, kotlin.Int, kotlin.Unit> origin=null
f: FUN_EXPR type=kotlin.reflect.KFunction2<<root>.C, kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:extensionVararg visibility:local modality:FINAL <> (p0:<root>.C, p1:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:<root>.C
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p1 index:1 type:kotlin.Int
@@ -52,11 +52,10 @@ FILE fqName:<root> fileName:/adaptedExtensionFunctions.kt
CALL 'public final fun extensionVararg (i: kotlin.Int, vararg s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
$receiver: GET_VAR 'p0: <root>.C declared in <root>.testExtensionVararg.extensionVararg' type=<root>.C origin=null
i: GET_VAR 'p1: kotlin.Int declared in <root>.testExtensionVararg.extensionVararg' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun extensionVararg (p0: <root>.C, p1: kotlin.Int): kotlin.Unit declared in <root>.testExtensionVararg' type=kotlin.reflect.KFunction2<<root>.C, kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
FUN name:testExtensionDefault visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun use (f: @[ExtensionFunctionType] kotlin.Function2<<root>.C, kotlin.Int, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
f: BLOCK type=kotlin.reflect.KFunction2<<root>.C, kotlin.Int, kotlin.Unit> origin=null
f: FUN_EXPR type=kotlin.reflect.KFunction2<<root>.C, kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:extensionDefault visibility:local modality:FINAL <> (p0:<root>.C, p1:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:<root>.C
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p1 index:1 type:kotlin.Int
@@ -64,11 +63,10 @@ FILE fqName:<root> fileName:/adaptedExtensionFunctions.kt
CALL 'public final fun extensionDefault (i: kotlin.Int, s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
$receiver: GET_VAR 'p0: <root>.C declared in <root>.testExtensionDefault.extensionDefault' type=<root>.C origin=null
i: GET_VAR 'p1: kotlin.Int declared in <root>.testExtensionDefault.extensionDefault' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun extensionDefault (p0: <root>.C, p1: kotlin.Int): kotlin.Unit declared in <root>.testExtensionDefault' type=kotlin.reflect.KFunction2<<root>.C, kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
FUN name:testExtensionBoth visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun use (f: @[ExtensionFunctionType] kotlin.Function2<<root>.C, kotlin.Int, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
f: BLOCK type=kotlin.reflect.KFunction2<<root>.C, kotlin.Int, kotlin.Unit> origin=null
f: FUN_EXPR type=kotlin.reflect.KFunction2<<root>.C, kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:extensionBoth visibility:local modality:FINAL <> (p0:<root>.C, p1:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:<root>.C
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p1 index:1 type:kotlin.Int
@@ -76,4 +74,3 @@ FILE fqName:<root> fileName:/adaptedExtensionFunctions.kt
CALL 'public final fun extensionBoth (i: kotlin.Int, s: kotlin.String, vararg t: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
$receiver: GET_VAR 'p0: <root>.C declared in <root>.testExtensionBoth.extensionBoth' type=<root>.C origin=null
i: GET_VAR 'p1: kotlin.Int declared in <root>.testExtensionBoth.extensionBoth' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun extensionBoth (p0: <root>.C, p1: kotlin.Int): kotlin.Unit declared in <root>.testExtensionBoth' type=kotlin.reflect.KFunction2<<root>.C, kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
@@ -0,0 +1,41 @@
FILE fqName:<root> fileName:/adaptedWithCoercionToUnit.kt
FUN name:useUnit0 visibility:public modality:FINAL <> (fn:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:fn index:0 type:kotlin.Function0<kotlin.Unit>
BLOCK_BODY
FUN name:useUnit1 visibility:public modality:FINAL <> (fn:kotlin.Function1<kotlin.Int, kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:fn index:0 type:kotlin.Function1<kotlin.Int, kotlin.Unit>
BLOCK_BODY
FUN name:fn0 visibility:public modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun fn0 (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=1
FUN name:fn1 visibility:public modality:FINAL <> (x:kotlin.Int) returnType:kotlin.Int
VALUE_PARAMETER name:x index:0 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun fn1 (x: kotlin.Int): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=1
FUN name:fnv visibility:public modality:FINAL <> (xs:kotlin.IntArray) returnType:kotlin.Int
VALUE_PARAMETER name:xs index:0 type:kotlin.IntArray varargElementType:kotlin.Int [vararg]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun fnv (vararg xs: kotlin.Int): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=1
FUN name:test0 visibility:public modality:FINAL <> () returnType:IrErrorType
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test0 (): IrErrorType declared in <root>'
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/useUnit0]>#' type=IrErrorType
FUNCTION_REFERENCE 'public final fun fn0 (): kotlin.Int declared in <root>' type=kotlin.reflect.KFunction0<kotlin.Int> origin=null reflectionTarget=<same>
FUN name:test1 visibility:public modality:FINAL <> () returnType:IrErrorType
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test1 (): IrErrorType declared in <root>'
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/useUnit1]>#' type=IrErrorType
FUNCTION_REFERENCE 'public final fun fn1 (x: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Int> origin=null reflectionTarget=<same>
FUN name:testV0 visibility:public modality:FINAL <> () returnType:IrErrorType
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testV0 (): IrErrorType declared in <root>'
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/useUnit0]>#' type=IrErrorType
FUNCTION_REFERENCE 'public final fun fnv (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.reflect.KFunction1<kotlin.IntArray, kotlin.Int> origin=null reflectionTarget=<same>
FUN name:testV1 visibility:public modality:FINAL <> () returnType:IrErrorType
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testV1 (): IrErrorType declared in <root>'
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/useUnit1]>#' type=IrErrorType
FUNCTION_REFERENCE 'public final fun fnv (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.reflect.KFunction1<kotlin.IntArray, kotlin.Int> origin=null reflectionTarget=<same>
@@ -0,0 +1,11 @@
fun useUnit0(fn: () -> Unit) {}
fun useUnit1(fn: (Int) -> Unit) {}
fun fn0() = 1
fun fn1(x: Int) = 1
fun fnv(vararg xs: Int) = 1
fun test0() = useUnit0(::fn0)
fun test1() = useUnit1(::fn1)
fun testV0() = useUnit0(::fnv)
fun testV1() = useUnit1(::fnv)
@@ -0,0 +1,62 @@
FILE fqName:<root> fileName:/adaptedWithCoercionToUnit.kt
FUN name:useUnit0 visibility:public modality:FINAL <> (fn:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:fn index:0 type:kotlin.Function0<kotlin.Unit>
BLOCK_BODY
FUN name:useUnit1 visibility:public modality:FINAL <> (fn:kotlin.Function1<kotlin.Int, kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:fn index:0 type:kotlin.Function1<kotlin.Int, kotlin.Unit>
BLOCK_BODY
FUN name:fn0 visibility:public modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun fn0 (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=1
FUN name:fn1 visibility:public modality:FINAL <> (x:kotlin.Int) returnType:kotlin.Int
VALUE_PARAMETER name:x index:0 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun fn1 (x: kotlin.Int): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=1
FUN name:fnv visibility:public modality:FINAL <> (xs:kotlin.IntArray) returnType:kotlin.Int
VALUE_PARAMETER name:xs index:0 type:kotlin.IntArray varargElementType:kotlin.Int [vararg]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun fnv (vararg xs: kotlin.Int): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=1
FUN name:test0 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test0 (): kotlin.Unit declared in <root>'
CALL 'public final fun useUnit0 (fn: kotlin.Function0<kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction0<kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:fn0 visibility:local modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun fn0 (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test1 (): kotlin.Unit declared in <root>'
CALL 'public final fun useUnit1 (fn: kotlin.Function1<kotlin.Int, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:fn1 visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE 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 fn1 (x: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.Int origin=null
x: GET_VAR 'p0: kotlin.Int declared in <root>.test1.fn1' type=kotlin.Int origin=null
FUN name:testV0 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testV0 (): kotlin.Unit declared in <root>'
CALL 'public final fun useUnit0 (fn: kotlin.Function0<kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction0<kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:fnv visibility:local modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun fnv (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.Int origin=null
FUN name:testV1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testV1 (): kotlin.Unit declared in <root>'
CALL 'public final fun useUnit1 (fn: kotlin.Function1<kotlin.Int, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:fnv visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE 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 fnv (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.Int origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.testV1.fnv' type=kotlin.Int origin=null
@@ -109,7 +109,7 @@ FILE fqName:<root> fileName:/caoWithAdaptationForSam.kt
GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.A
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:<root>.IFoo [val]
TYPE_OP type=<root>.IFoo origin=SAM_CONVERSION typeOperand=<root>.IFoo
BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null
FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -117,7 +117,6 @@ FILE fqName:<root> fileName:/caoWithAdaptationForSam.kt
CALL 'public final fun withVararg (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.Int origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.test1.withVararg' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in <root>.test1' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
CALL 'public final fun set (i: <root>.IFoo, newValue: kotlin.Int): kotlin.Unit [operator] declared in <root>' type=kotlin.Unit origin=PLUSEQ
$receiver: GET_VAR 'val tmp_0: <root>.A [val] declared in <root>.test1' type=<root>.A origin=null
i: GET_VAR 'val tmp_1: <root>.IFoo [val] declared in <root>.test1' type=<root>.IFoo origin=null
@@ -133,7 +132,7 @@ FILE fqName:<root> fileName:/caoWithAdaptationForSam.kt
GET_OBJECT 'CLASS OBJECT name:B modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.B
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:<root>.IFoo2 [val]
TYPE_OP type=<root>.IFoo2 origin=SAM_CONVERSION typeOperand=<root>.IFoo2
BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null
FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -141,7 +140,6 @@ FILE fqName:<root> fileName:/caoWithAdaptationForSam.kt
CALL 'public final fun withVararg (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.Int origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.test2.withVararg' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in <root>.test2' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
CALL 'public final fun set (i: <root>.IFoo2, newValue: kotlin.Int): kotlin.Unit [operator] declared in <root>' type=kotlin.Unit origin=PLUSEQ
$receiver: GET_VAR 'val tmp_2: <root>.B [val] declared in <root>.test2' type=<root>.B origin=null
i: GET_VAR 'val tmp_3: <root>.IFoo2 [val] declared in <root>.test2' type=<root>.IFoo2 origin=null
@@ -70,7 +70,7 @@ FILE fqName:<root> fileName:/constructorWithAdaptedArguments.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testConstructor (): kotlin.Any declared in <root>'
CALL 'public final fun use (fn: kotlin.Function1<kotlin.Int, kotlin.Any>): kotlin.Any declared in <root>' type=kotlin.Any origin=null
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, <root>.C> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, <root>.C> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:<init> visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:<root>.C
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -78,13 +78,12 @@ FILE fqName:<root> fileName:/constructorWithAdaptedArguments.kt
CONSTRUCTOR_CALL 'public constructor <init> (vararg xs: kotlin.Int) [primary] declared in <root>.C' type=<root>.C origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.testConstructor.<init>' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun <init> (p0: kotlin.Int): <root>.C declared in <root>.testConstructor' type=kotlin.reflect.KFunction1<kotlin.Int, <root>.C> origin=null reflectionTarget=null
FUN name:testInnerClassConstructor visibility:public modality:FINAL <> (outer:<root>.Outer) returnType:kotlin.Any
VALUE_PARAMETER name:outer index:0 type:<root>.Outer
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testInnerClassConstructor (outer: <root>.Outer): kotlin.Any declared in <root>'
CALL 'public final fun use (fn: kotlin.Function1<kotlin.Int, kotlin.Any>): kotlin.Any declared in <root>' type=kotlin.Any origin=null
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, <root>.Outer.Inner> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, <root>.Outer.Inner> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:<init> visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:<root>.Outer.Inner
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -93,7 +92,6 @@ FILE fqName:<root> fileName:/constructorWithAdaptedArguments.kt
$outer: GET_VAR 'outer: <root>.Outer declared in <root>.testInnerClassConstructor' type=<root>.Outer origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.testInnerClassConstructor.<init>' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun <init> (p0: kotlin.Int): <root>.Outer.Inner declared in <root>.testInnerClassConstructor' type=kotlin.reflect.KFunction1<kotlin.Int, <root>.Outer.Inner> origin=null reflectionTarget=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 <root>'
@@ -101,12 +99,12 @@ FILE fqName:<root> fileName:/constructorWithAdaptedArguments.kt
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, <root>.Outer.Inner> origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.Outer [val]
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Outer' type=<root>.Outer origin=null
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:<init> visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:<root>.Outer.Inner
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <init> (p0: kotlin.Int): <root>.Outer.Inner declared in <root>.testInnerClassConstructorCapturingOuter'
CONSTRUCTOR_CALL 'public constructor <init> (vararg xs: kotlin.Int) [primary] declared in <root>.Outer.Inner' type=<root>.Outer.Inner origin=null
$outer: GET_VAR 'val tmp_0: <root>.Outer [val] declared in <root>.testInnerClassConstructorCapturingOuter' type=<root>.Outer origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.testInnerClassConstructorCapturingOuter.<init>' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun <init> (p0: kotlin.Int): <root>.Outer.Inner declared in <root>.testInnerClassConstructorCapturingOuter' type=kotlin.reflect.KFunction1<kotlin.Int, <root>.Outer.Inner> origin=null reflectionTarget=null
FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, <root>.Outer.Inner> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:<init> visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:<root>.Outer.Inner
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <init> (p0: kotlin.Int): <root>.Outer.Inner declared in <root>.testInnerClassConstructorCapturingOuter'
CONSTRUCTOR_CALL 'public constructor <init> (vararg xs: kotlin.Int) [primary] declared in <root>.Outer.Inner' type=<root>.Outer.Inner origin=null
$outer: GET_VAR 'val tmp_0: <root>.Outer [val] declared in <root>.testInnerClassConstructorCapturingOuter' type=<root>.Outer origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.testInnerClassConstructorCapturingOuter.<init>' type=kotlin.Int origin=null
@@ -49,19 +49,17 @@ FILE fqName:<root> fileName:/kt37131.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testFn (): kotlin.Any declared in <root>'
CALL 'public final fun use (fn: kotlin.Function0<kotlin.Any>): kotlin.Any declared in <root>' type=kotlin.Any origin=null
fn: BLOCK type=kotlin.reflect.KFunction0<kotlin.String> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction0<kotlin.String> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:foo visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun foo (): kotlin.String declared in <root>.testFn'
CALL 'public final fun foo (x: kotlin.String): kotlin.String declared in <root>' type=kotlin.String origin=null
FUNCTION_REFERENCE 'local final fun foo (): kotlin.String declared in <root>.testFn' type=kotlin.reflect.KFunction0<kotlin.String> origin=null reflectionTarget=null
FUN name:testCtor visibility:public modality:FINAL <> () returnType:kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testCtor (): kotlin.Any declared in <root>'
CALL 'public final fun use (fn: kotlin.Function0<kotlin.Any>): kotlin.Any declared in <root>' type=kotlin.Any origin=null
fn: BLOCK type=kotlin.reflect.KFunction0<<root>.C> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction0<<root>.C> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:<init> visibility:local modality:FINAL <> () returnType:<root>.C
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <init> (): <root>.C declared in <root>.testCtor'
CONSTRUCTOR_CALL 'public constructor <init> (x: kotlin.String) [primary] declared in <root>.C' type=<root>.C origin=null
FUNCTION_REFERENCE 'local final fun <init> (): <root>.C declared in <root>.testCtor' type=kotlin.reflect.KFunction0<<root>.C> origin=null reflectionTarget=null
@@ -60,7 +60,7 @@ FILE fqName:<root> fileName:/unboundMemberReferenceWithAdaptedArguments.kt
FUN name:testUnbound visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun use1 (fn: kotlin.Function2<<root>.A, kotlin.Int, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: BLOCK type=kotlin.reflect.KFunction2<<root>.A, kotlin.Int, kotlin.Unit> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction2<<root>.A, kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:foo visibility:local modality:FINAL <> (p0:<root>.A, p1:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:<root>.A
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p1 index:1 type:kotlin.Int
@@ -70,12 +70,11 @@ FILE fqName:<root> fileName:/unboundMemberReferenceWithAdaptedArguments.kt
$this: GET_VAR 'p0: <root>.A declared in <root>.testUnbound.foo' type=<root>.A origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p1: kotlin.Int declared in <root>.testUnbound.foo' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun foo (p0: <root>.A, p1: kotlin.Int): kotlin.Unit declared in <root>.testUnbound' type=kotlin.reflect.KFunction2<<root>.A, kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
FUN name:testBound visibility:public modality:FINAL <> (a:<root>.A) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:<root>.A
BLOCK_BODY
CALL 'public final fun use2 (fn: kotlin.Function1<kotlin.Int, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:foo visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -84,11 +83,10 @@ FILE fqName:<root> fileName:/unboundMemberReferenceWithAdaptedArguments.kt
$this: GET_VAR 'a: <root>.A declared in <root>.testBound' type=<root>.A origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.testBound.foo' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun foo (p0: kotlin.Int): kotlin.Unit declared in <root>.testBound' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
FUN name:testObject visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun use2 (fn: kotlin.Function1<kotlin.Int, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:foo visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -97,4 +95,3 @@ FILE fqName:<root> fileName:/unboundMemberReferenceWithAdaptedArguments.kt
$this: GET_OBJECT 'CLASS OBJECT name:Obj modality:FINAL visibility:public superTypes:[<root>.A]' type=<root>.Obj
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.testObject.foo' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun foo (p0: kotlin.Int): kotlin.Unit declared in <root>.testObject' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
@@ -29,7 +29,7 @@ FILE fqName:<root> fileName:/withAdaptationForSam.kt
BLOCK_BODY
CALL 'public final fun useFoo (foo: <root>.IFoo): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
foo: TYPE_OP type=<root>.IFoo origin=SAM_CONVERSION typeOperand=<root>.IFoo
BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null
FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -37,4 +37,3 @@ FILE fqName:<root> fileName:/withAdaptationForSam.kt
CALL 'public final fun withVararg (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.Int origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.test.withVararg' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in <root>.test' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
@@ -6,6 +6,12 @@ FILE fqName:<root> fileName:/withAdaptedArguments.kt
CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.String origin=INVOKE
$this: GET_VAR 'fn: kotlin.Function1<kotlin.Int, kotlin.String> declared in <root>.use' type=kotlin.Function1<kotlin.Int, kotlin.String> origin=null
p1: CONST Int type=kotlin.Int value=1
FUN name:use0 visibility:public modality:FINAL <> (fn:kotlin.Function0<kotlin.String>) returnType:kotlin.String
VALUE_PARAMETER name:fn index:0 type:kotlin.Function0<kotlin.String>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun use0 (fn: kotlin.Function0<kotlin.String>): kotlin.String declared in <root>'
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=kotlin.String origin=INVOKE
$this: GET_VAR 'fn: kotlin.Function0<kotlin.String> declared in <root>.use0' type=kotlin.Function0<kotlin.String> origin=null
FUN name:coerceToUnit visibility:public modality:FINAL <> (fn:kotlin.Function1<kotlin.Int, kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:fn index:0 type:kotlin.Function1<kotlin.Int, kotlin.Unit>
BLOCK_BODY
@@ -17,6 +23,16 @@ FILE fqName:<root> fileName:/withAdaptedArguments.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun fnWithDefault (a: kotlin.Int, b: kotlin.Int): kotlin.String declared in <root>'
CONST String type=kotlin.String value="abc"
FUN name:fnWithDefaults visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.String
VALUE_PARAMETER name:a index:0 type:kotlin.Int
EXPRESSION_BODY
CONST Int type=kotlin.Int value=1
VALUE_PARAMETER name:b index:1 type:kotlin.Int
EXPRESSION_BODY
CONST Int type=kotlin.Int value=2
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun fnWithDefaults (a: kotlin.Int, b: kotlin.Int): kotlin.String declared in <root>'
CONST String type=kotlin.String value=""
FUN name:fnWithVarargs visibility:public modality:FINAL <> (xs:kotlin.IntArray) returnType:kotlin.String
VALUE_PARAMETER name:xs index:0 type:kotlin.IntArray varargElementType:kotlin.Int [vararg]
BLOCK_BODY
@@ -68,3 +84,13 @@ FILE fqName:<root> fileName:/withAdaptedArguments.kt
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/use]>#' type=IrErrorType
FUNCTION_REFERENCE 'public final fun importedObjectMemberWithVarargs (vararg xs: kotlin.Int): kotlin.String declared in <root>.Host' type=kotlin.reflect.KFunction1<kotlin.IntArray, kotlin.String> origin=null reflectionTarget=<same>
$this: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Host
FUN name:testDefault0 visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testDefault0 (): kotlin.String declared in <root>'
CALL 'public final fun use0 (fn: kotlin.Function0<kotlin.String>): kotlin.String declared in <root>' type=kotlin.String origin=null
fn: FUNCTION_REFERENCE 'public final fun fnWithDefaults (a: kotlin.Int, b: kotlin.Int): kotlin.String declared in <root>' type=kotlin.reflect.KFunction0<kotlin.String> origin=null reflectionTarget=<same>
FUN name:testVararg0 visibility:public modality:FINAL <> () returnType:IrErrorType
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testVararg0 (): IrErrorType declared in <root>'
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/use0]>#' type=IrErrorType
FUNCTION_REFERENCE 'public final fun fnWithVarargs (vararg xs: kotlin.Int): kotlin.String declared in <root>' type=kotlin.reflect.KFunction1<kotlin.IntArray, kotlin.String> origin=null reflectionTarget=<same>
@@ -3,10 +3,14 @@ import Host.importedObjectMemberWithVarargs
fun use(fn: (Int) -> String) = fn(1)
fun use0(fn: () -> String) = fn()
fun coerceToUnit(fn: (Int) -> Unit) {}
fun fnWithDefault(a: Int, b: Int = 42) = "abc"
fun fnWithDefaults(a: Int = 1, b: Int = 2) = ""
fun fnWithVarargs(vararg xs: Int) = "abc"
object Host {
@@ -19,4 +23,8 @@ fun testVararg() = use(::fnWithVarargs)
fun testCoercionToUnit() = coerceToUnit(::fnWithDefault)
fun testImportedObjectMember() = use(::importedObjectMemberWithVarargs)
fun testImportedObjectMember() = use(::importedObjectMemberWithVarargs)
fun testDefault0() = use0(::fnWithDefaults)
fun testVararg0() = use0(::fnWithVarargs)
@@ -6,6 +6,12 @@ FILE fqName:<root> fileName:/withAdaptedArguments.kt
CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.String origin=INVOKE
$this: GET_VAR 'fn: kotlin.Function1<kotlin.Int, kotlin.String> declared in <root>.use' type=kotlin.Function1<kotlin.Int, kotlin.String> origin=VARIABLE_AS_FUNCTION
p1: CONST Int type=kotlin.Int value=1
FUN name:use0 visibility:public modality:FINAL <> (fn:kotlin.Function0<kotlin.String>) returnType:kotlin.String
VALUE_PARAMETER name:fn index:0 type:kotlin.Function0<kotlin.String>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun use0 (fn: kotlin.Function0<kotlin.String>): kotlin.String declared in <root>'
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=kotlin.String origin=INVOKE
$this: GET_VAR 'fn: kotlin.Function0<kotlin.String> declared in <root>.use0' type=kotlin.Function0<kotlin.String> origin=VARIABLE_AS_FUNCTION
FUN name:coerceToUnit visibility:public modality:FINAL <> (fn:kotlin.Function1<kotlin.Int, kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:fn index:0 type:kotlin.Function1<kotlin.Int, kotlin.Unit>
BLOCK_BODY
@@ -17,6 +23,16 @@ FILE fqName:<root> fileName:/withAdaptedArguments.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun fnWithDefault (a: kotlin.Int, b: kotlin.Int): kotlin.String declared in <root>'
CONST String type=kotlin.String value="abc"
FUN name:fnWithDefaults visibility:public modality:FINAL <> (a:kotlin.Int, b:kotlin.Int) returnType:kotlin.String
VALUE_PARAMETER name:a index:0 type:kotlin.Int
EXPRESSION_BODY
CONST Int type=kotlin.Int value=1
VALUE_PARAMETER name:b index:1 type:kotlin.Int
EXPRESSION_BODY
CONST Int type=kotlin.Int value=2
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun fnWithDefaults (a: kotlin.Int, b: kotlin.Int): kotlin.String declared in <root>'
CONST String type=kotlin.String value=""
FUN name:fnWithVarargs visibility:public modality:FINAL <> (xs:kotlin.IntArray) returnType:kotlin.String
VALUE_PARAMETER name:xs index:0 type:kotlin.IntArray varargElementType:kotlin.Int [vararg]
BLOCK_BODY
@@ -51,19 +67,18 @@ FILE fqName:<root> fileName:/withAdaptedArguments.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testDefault (): kotlin.String declared in <root>'
CALL 'public final fun use (fn: kotlin.Function1<kotlin.Int, kotlin.String>): kotlin.String declared in <root>' type=kotlin.String origin=null
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.String> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.String> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:fnWithDefault visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.String
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun fnWithDefault (p0: kotlin.Int): kotlin.String declared in <root>.testDefault'
CALL 'public final fun fnWithDefault (a: kotlin.Int, b: kotlin.Int): kotlin.String declared in <root>' type=kotlin.String origin=null
a: GET_VAR 'p0: kotlin.Int declared in <root>.testDefault.fnWithDefault' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun fnWithDefault (p0: kotlin.Int): kotlin.String declared in <root>.testDefault' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.String> origin=null reflectionTarget=null
FUN name:testVararg visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testVararg (): kotlin.String declared in <root>'
CALL 'public final fun use (fn: kotlin.Function1<kotlin.Int, kotlin.String>): kotlin.String declared in <root>' type=kotlin.String origin=null
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.String> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.String> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:fnWithVarargs visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.String
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -71,24 +86,22 @@ FILE fqName:<root> fileName:/withAdaptedArguments.kt
CALL 'public final fun fnWithVarargs (vararg xs: kotlin.Int): kotlin.String declared in <root>' type=kotlin.String origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.testVararg.fnWithVarargs' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun fnWithVarargs (p0: kotlin.Int): kotlin.String declared in <root>.testVararg' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.String> origin=null reflectionTarget=null
FUN name:testCoercionToUnit visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testCoercionToUnit (): kotlin.Unit declared in <root>'
CALL 'public final fun coerceToUnit (fn: kotlin.Function1<kotlin.Int, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:fnWithDefault visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE 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 fnWithDefault (a: kotlin.Int, b: kotlin.Int): kotlin.String declared in <root>' type=kotlin.String origin=null
a: GET_VAR 'p0: kotlin.Int declared in <root>.testCoercionToUnit.fnWithDefault' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun fnWithDefault (p0: kotlin.Int): kotlin.Unit declared in <root>.testCoercionToUnit' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
FUN name:testImportedObjectMember visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testImportedObjectMember (): kotlin.String declared in <root>'
CALL 'public final fun use (fn: kotlin.Function1<kotlin.Int, kotlin.String>): kotlin.String declared in <root>' type=kotlin.String origin=null
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.String> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.String> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:importedObjectMemberWithVarargs visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.String
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -97,4 +110,21 @@ FILE fqName:<root> fileName:/withAdaptedArguments.kt
$this: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Host
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.testImportedObjectMember.importedObjectMemberWithVarargs' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun importedObjectMemberWithVarargs (p0: kotlin.Int): kotlin.String declared in <root>.testImportedObjectMember' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.String> origin=null reflectionTarget=null
FUN name:testDefault0 visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testDefault0 (): kotlin.String declared in <root>'
CALL 'public final fun use0 (fn: kotlin.Function0<kotlin.String>): kotlin.String declared in <root>' type=kotlin.String origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction0<kotlin.String> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:fnWithDefaults visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun fnWithDefaults (): kotlin.String declared in <root>.testDefault0'
CALL 'public final fun fnWithDefaults (a: kotlin.Int, b: kotlin.Int): kotlin.String declared in <root>' type=kotlin.String origin=null
FUN name:testVararg0 visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testVararg0 (): kotlin.String declared in <root>'
CALL 'public final fun use0 (fn: kotlin.Function0<kotlin.String>): kotlin.String declared in <root>' type=kotlin.String origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction0<kotlin.String> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:fnWithVarargs visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun fnWithVarargs (): kotlin.String declared in <root>.testVararg0'
CALL 'public final fun fnWithVarargs (vararg xs: kotlin.Int): kotlin.String declared in <root>' type=kotlin.String origin=null
@@ -21,7 +21,7 @@ FILE fqName:<root> fileName:/withArgumentAdaptationAndReceiver.kt
$this: VALUE_PARAMETER name:<this> type:<root>.Host
BLOCK_BODY
CALL 'public final fun use (fn: kotlin.Function1<kotlin.Int, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -30,14 +30,13 @@ FILE fqName:<root> fileName:/withArgumentAdaptationAndReceiver.kt
$this: GET_VAR '<this>: <root>.Host declared in <root>.Host.testImplicitThis' type=<root>.Host origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.Host.testImplicitThis.withVararg' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in <root>.Host.testImplicitThis' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
FUN name:testBoundReceiverLocalVal visibility:public modality:FINAL <> ($this:<root>.Host) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Host
BLOCK_BODY
VAR name:h type:<root>.Host [val]
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Host' type=<root>.Host origin=null
CALL 'public final fun use (fn: kotlin.Function1<kotlin.Int, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -46,7 +45,6 @@ FILE fqName:<root> fileName:/withArgumentAdaptationAndReceiver.kt
$this: GET_VAR 'val h: <root>.Host [val] declared in <root>.Host.testBoundReceiverLocalVal' type=<root>.Host origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.Host.testBoundReceiverLocalVal.withVararg' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in <root>.Host.testBoundReceiverLocalVal' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
FUN name:testBoundReceiverLocalVar visibility:public modality:FINAL <> ($this:<root>.Host) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Host
BLOCK_BODY
@@ -56,21 +54,21 @@ FILE fqName:<root> fileName:/withArgumentAdaptationAndReceiver.kt
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.Host [val]
GET_VAR 'var h: <root>.Host [var] declared in <root>.Host.testBoundReceiverLocalVar' type=<root>.Host origin=null
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE 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 <root>.Host' type=kotlin.String origin=null
$this: GET_VAR 'val tmp_0: <root>.Host [val] declared in <root>.Host.testBoundReceiverLocalVar' type=<root>.Host origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.Host.testBoundReceiverLocalVar.withVararg' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in <root>.Host.testBoundReceiverLocalVar' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE 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 <root>.Host' type=kotlin.String origin=null
$this: GET_VAR 'val tmp_0: <root>.Host [val] declared in <root>.Host.testBoundReceiverLocalVar' type=<root>.Host origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.Host.testBoundReceiverLocalVar.withVararg' type=kotlin.Int origin=null
FUN name:testBoundReceiverParameter visibility:public modality:FINAL <> ($this:<root>.Host, h:<root>.Host) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Host
VALUE_PARAMETER name:h index:0 type:<root>.Host
BLOCK_BODY
CALL 'public final fun use (fn: kotlin.Function1<kotlin.Int, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -79,7 +77,6 @@ FILE fqName:<root> fileName:/withArgumentAdaptationAndReceiver.kt
$this: GET_VAR 'h: <root>.Host declared in <root>.Host.testBoundReceiverParameter' type=<root>.Host origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.Host.testBoundReceiverParameter.withVararg' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in <root>.Host.testBoundReceiverParameter' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
FUN name:testBoundReceiverExpression visibility:public modality:FINAL <> ($this:<root>.Host) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.Host
BLOCK_BODY
@@ -87,15 +84,15 @@ FILE fqName:<root> fileName:/withArgumentAdaptationAndReceiver.kt
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:<root>.Host [val]
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Host' type=<root>.Host origin=null
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE 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 <root>.Host' type=kotlin.String origin=null
$this: GET_VAR 'val tmp_1: <root>.Host [val] declared in <root>.Host.testBoundReceiverExpression' type=<root>.Host origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.Host.testBoundReceiverExpression.withVararg' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun withVararg (p0: kotlin.Int): kotlin.Unit declared in <root>.Host.testBoundReceiverExpression' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:withVararg visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE 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 <root>.Host' type=kotlin.String origin=null
$this: GET_VAR 'val tmp_1: <root>.Host [val] declared in <root>.Host.testBoundReceiverExpression' type=<root>.Host origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.Host.testBoundReceiverExpression.withVararg' type=kotlin.Int origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
@@ -61,7 +61,7 @@ FILE fqName:<root> fileName:/withVarargViewedAsArray.kt
FUN name:testPlainArgs visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun usePlainArgs (fn: kotlin.Function2<kotlin.Int, kotlin.Int, kotlin.Int>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: BLOCK type=kotlin.reflect.KFunction2<kotlin.Int, kotlin.Int, kotlin.Int> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction2<kotlin.Int, kotlin.Int, kotlin.Int> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:sum visibility:local modality:FINAL <> (p0:kotlin.Int, p1:kotlin.Int) returnType:kotlin.Int
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p1 index:1 type:kotlin.Int
@@ -71,7 +71,6 @@ FILE fqName:<root> fileName:/withVarargViewedAsArray.kt
args: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.testPlainArgs.sum' type=kotlin.Int origin=null
GET_VAR 'p1: kotlin.Int declared in <root>.testPlainArgs.sum' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun sum (p0: kotlin.Int, p1: kotlin.Int): kotlin.Int declared in <root>.testPlainArgs' type=kotlin.reflect.KFunction2<kotlin.Int, kotlin.Int, kotlin.Int> origin=null reflectionTarget=null
FUN name:testPrimitiveArrayAsVararg visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun usePrimitiveArray (fn: kotlin.Function1<kotlin.IntArray, kotlin.Int>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
@@ -83,7 +82,7 @@ FILE fqName:<root> fileName:/withVarargViewedAsArray.kt
FUN name:testArrayAndDefaults visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun useStringArray (fn: kotlin.Function1<kotlin.Array<kotlin.String>, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: BLOCK type=kotlin.reflect.KFunction1<kotlin.Array<out kotlin.String>, kotlin.Unit> origin=null
fn: FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Array<out kotlin.String>, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:zap visibility:local modality:FINAL <> (p0:kotlin.Array<out kotlin.String>) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Array<out kotlin.String>
BLOCK_BODY
@@ -91,4 +90,3 @@ FILE fqName:<root> fileName:/withVarargViewedAsArray.kt
b: VARARG type=kotlin.Array<out kotlin.String> varargElementType=kotlin.String
SPREAD_ELEMENT
GET_VAR 'p0: kotlin.Array<out kotlin.String> declared in <root>.testArrayAndDefaults.zap' type=kotlin.Array<out kotlin.String> origin=null
FUNCTION_REFERENCE 'local final fun zap (p0: kotlin.Array<out kotlin.String>): kotlin.Unit declared in <root>.testArrayAndDefaults' type=kotlin.reflect.KFunction1<kotlin.Array<out kotlin.String>, kotlin.Unit> origin=null reflectionTarget=null
@@ -66,7 +66,7 @@ FILE fqName:<root> fileName:/samConversionInVarargs.kt
CALL 'public final fun useVararg (vararg foos: <root>.IFoo): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
foos: VARARG type=kotlin.Array<out <root>.IFoo> varargElementType=<root>.IFoo
TYPE_OP type=<root>.IFoo origin=SAM_CONVERSION typeOperand=<root>.IFoo
BLOCK type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null
FUN_EXPR type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:withVarargOfInt visibility:local modality:FINAL <> (p0:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE name:p0 index:0 type:kotlin.Int
BLOCK_BODY
@@ -74,4 +74,3 @@ FILE fqName:<root> fileName:/samConversionInVarargs.kt
CALL 'public final fun withVarargOfInt (vararg xs: kotlin.Int): kotlin.String declared in <root>' type=kotlin.String origin=null
xs: VARARG type=kotlin.IntArray varargElementType=kotlin.Int
GET_VAR 'p0: kotlin.Int declared in <root>.testAdaptedCR.withVarargOfInt' type=kotlin.Int origin=null
FUNCTION_REFERENCE 'local final fun withVarargOfInt (p0: kotlin.Int): kotlin.Unit declared in <root>.testAdaptedCR' type=kotlin.reflect.KFunction1<kotlin.Int, kotlin.Unit> origin=null reflectionTarget=null
@@ -35,7 +35,11 @@ FILE fqName:<root> fileName:/samConversionOnCallableReference.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun testSamCosntructorOnAdapted (): <root>.KRunnable declared in <root>'
TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
FUNCTION_REFERENCE 'public final fun foo1 (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null reflectionTarget=<same>
FUN_EXPR type=kotlin.reflect.KFunction0<kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:foo1 visibility:local modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun foo1 (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.Int origin=null
FUN name:testSamConversion visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun use (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
@@ -45,4 +49,8 @@ FILE fqName:<root> fileName:/samConversionOnCallableReference.kt
BLOCK_BODY
CALL 'public final fun use (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
FUNCTION_REFERENCE 'public final fun foo1 (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null reflectionTarget=<same>
FUN_EXPR type=kotlin.reflect.KFunction0<kotlin.Unit> origin=LAMBDA
FUN ADAPTER_FOR_CALLABLE_REFERENCE name:foo1 visibility:local modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun foo1 (vararg xs: kotlin.Int): kotlin.Int declared in <root>' type=kotlin.Int origin=null
@@ -2003,6 +2003,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/callableReference/nested.kt");
}
@TestMetadata("noReflectionForAdaptedCallableReferences.kt")
public void testNoReflectionForAdaptedCallableReferences() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/noReflectionForAdaptedCallableReferences.kt");
}
@TestMetadata("optimizedSuperclasses_after.kt")
public void testOptimizedSuperclasses_after() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/optimizedSuperclasses_after.kt");
@@ -2003,6 +2003,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/callableReference/nested.kt");
}
@TestMetadata("noReflectionForAdaptedCallableReferences.kt")
public void testNoReflectionForAdaptedCallableReferences() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/noReflectionForAdaptedCallableReferences.kt");
}
@TestMetadata("optimizedSuperclasses_after.kt")
public void testOptimizedSuperclasses_after() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/optimizedSuperclasses_after.kt");
@@ -1983,6 +1983,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/callableReference/nested.kt");
}
@TestMetadata("noReflectionForAdaptedCallableReferences.kt")
public void testNoReflectionForAdaptedCallableReferences() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/noReflectionForAdaptedCallableReferences.kt");
}
@TestMetadata("optimizedSuperclasses_after.kt")
public void testOptimizedSuperclasses_after() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/optimizedSuperclasses_after.kt");
@@ -1394,6 +1394,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
runTest("compiler/testData/ir/irText/expressions/callableReferences/adaptedExtensionFunctions.kt");
}
@TestMetadata("adaptedWithCoercionToUnit.kt")
public void testAdaptedWithCoercionToUnit() throws Exception {
runTest("compiler/testData/ir/irText/expressions/callableReferences/adaptedWithCoercionToUnit.kt");
}
public void testAllFilesPresentInCallableReferences() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/callableReferences"), Pattern.compile("^(.+)\\.kt$"), null, true);
}