diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/WasmLoweringPhases.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/WasmLoweringPhases.kt index e524c8dab57..bb4b83f22d9 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/WasmLoweringPhases.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/WasmLoweringPhases.kt @@ -341,13 +341,6 @@ private val wasmNullSpecializationLowering = makeWasmModulePhase( description = "Specialize assigning Nothing? values to other types." ) -private val wasmFunctionInterfaceReplacer = makeWasmModulePhase( - ::WasmFunctionInterfaceReplacer, - name = "WasmFunctionInterfaceReplacer", - description = "Replace function interface with concrete runtime interfaces" -) - - private val staticMembersLoweringPhase = makeWasmModulePhase( ::StaticMembersLowering, name = "StaticMembersLowering", @@ -527,7 +520,6 @@ val wasmPhases = NamedCompilerPhase( virtualDispatchReceiverExtractionPhase then staticMembersLoweringPhase then - wasmFunctionInterfaceReplacer then wasmNullSpecializationLowering then validateIrAfterLowering ) diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/WasmSymbols.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/WasmSymbols.kt index 435fa0dec4f..4f7c6727bd9 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/WasmSymbols.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/WasmSymbols.kt @@ -168,18 +168,6 @@ class WasmSymbols( val kTypeStub = getInternalFunction("kTypeStub") - private val functionNInterfaces = (0..22).map { arity -> - getIrClass(FqName("kotlin.wasm.internal.Function$arity")) - } - - val functionNInvokeMethods by lazy { - functionNInterfaces.map { interfaceSymbol -> - interfaceSymbol.owner.declarations.filterIsInstance().single { method -> - method.name == OperatorNameConventions.INVOKE - }.symbol - } - } - val arraysCopyInto = findFunctions(collectionsPackage.memberScope, Name.identifier("copyInto")) .map { symbolTable.referenceSimpleFunction(it) } @@ -208,9 +196,6 @@ class WasmSymbols( } } - override fun functionN(n: Int): IrClassSymbol = - functionNInterfaces[n] - private fun findClass(memberScope: MemberScope, name: Name): ClassDescriptor = memberScope.getContributedClassifier(name, NoLookupLocation.FROM_BACKEND) as ClassDescriptor diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt index 89cd5a0e9c9..50500b5e7cb 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt @@ -32,7 +32,12 @@ fun compileWasm( ): WasmCompilerResult { val mainModule = depsDescriptors.mainModule val configuration = depsDescriptors.compilerConfiguration - val (moduleFragment, dependencyModules, irBuiltIns, symbolTable, deserializer) = loadIr(depsDescriptors, irFactory, verifySignatures = false) + val (moduleFragment, dependencyModules, irBuiltIns, symbolTable, deserializer) = loadIr( + depsDescriptors, + irFactory, + verifySignatures = false, + loadFunctionInterfacesIntoStdlib = true, + ) val allModules = when (mainModule) { is MainModule.SourceFiles -> dependencyModules + listOf(moduleFragment) diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmModuleCodegenContextImpl.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmModuleCodegenContextImpl.kt index 2f8fa17057b..44c82686fb0 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmModuleCodegenContextImpl.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/WasmModuleCodegenContextImpl.kt @@ -180,12 +180,6 @@ class WasmModuleCodegenContextImpl( override fun referenceInterfaceId(irInterface: IrClassSymbol): WasmSymbol { - // HACK to substitute kotlin.Function5 with kotlin.wasm.internal.Function5 - val defaultType = irInterface.defaultType - if (defaultType.isFunction()) { - val n = irInterface.owner.typeParameters.size - 1 - return wasmFragment.interfaceId.reference(backendContext.wasmSymbols.functionN(n)) - } return wasmFragment.interfaceId.reference(irInterface) } diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/BuiltInsLowering.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/BuiltInsLowering.kt index 869a9c0ca3e..a8c5c4a99fe 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/BuiltInsLowering.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/BuiltInsLowering.kt @@ -123,24 +123,9 @@ class BuiltInsLowering(val context: WasmBackendContext) : FileLoweringPass { } } - val nativeInvokeArity = getKotlinFunctionInvokeArity(call) - if (nativeInvokeArity != null) { - return irCall(call, symbols.functionNInvokeMethods[nativeInvokeArity]) - } - return call } - private fun getKotlinFunctionInvokeArity(call: IrCall): Int? { - val simpleFunction = call.symbol.owner as? IrSimpleFunction ?: return null - val receiverType = simpleFunction.dispatchReceiverParameter?.type ?: return null - if (simpleFunction.isSuspend) return null - if (simpleFunction.name == OperatorNameConventions.INVOKE && receiverType.isFunction()) { - return simpleFunction.valueParameters.size - } - return null - } - override fun lower(irFile: IrFile) { val builder = context.createIrBuilder(irFile.symbol) irFile.transformChildrenVoid(object : IrElementTransformerVoidWithContext() { diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmFunctionInterfaceReplacer.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmFunctionInterfaceReplacer.kt deleted file mode 100644 index 5172ffa2530..00000000000 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmFunctionInterfaceReplacer.kt +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.backend.wasm.lower - -import org.jetbrains.kotlin.backend.common.FileLoweringPass -import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext -import org.jetbrains.kotlin.backend.wasm.WasmBackendContext -import org.jetbrains.kotlin.ir.IrStatement -import org.jetbrains.kotlin.ir.declarations.IrClass -import org.jetbrains.kotlin.ir.declarations.IrFile -import org.jetbrains.kotlin.ir.types.IrSimpleType -import org.jetbrains.kotlin.ir.types.IrType -import org.jetbrains.kotlin.ir.types.typeWithArguments -import org.jetbrains.kotlin.ir.util.isFunction -import org.jetbrains.kotlin.ir.util.render -import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid - -/** - * Replace kotlin.Function{N} etc super types with kotlin.wasm.internal.Function{N} super types. - * This is a workaround for having a concrete IR for these interfaces. - */ -class WasmFunctionInterfaceReplacer(val context: WasmBackendContext) : FileLoweringPass { - - private fun replaceType(type: IrType): IrType { - if (type.isFunction()) { - require(type is IrSimpleType) - val klass: IrClass = type.classifier.owner as IrClass - - // No need to replace just "kotlin.Function" - if (klass.name.identifier == "Function") { - return type - } - - val arity = klass.typeParameters.size - 1 - return context.wasmSymbols.functionN(arity).typeWithArguments(type.arguments) - } - - return type - } - - override fun lower(irFile: IrFile) { - irFile.transformChildrenVoid(object : IrElementTransformerVoidWithContext() { - override fun visitClassNew(declaration: IrClass): IrStatement { - if (declaration.superTypes.any { it.isFunction() }) { - declaration.superTypes = declaration.superTypes.map { replaceType(it) } - } - return super.visitClassNew(declaration) - } - }) - } -} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrDescriptorBasedFunctionFactory.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrDescriptorBasedFunctionFactory.kt index 72d93c1f8ab..6c8158fcecc 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrDescriptorBasedFunctionFactory.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/descriptors/IrDescriptorBasedFunctionFactory.kt @@ -83,8 +83,12 @@ abstract class IrAbstractDescriptorBasedFunctionFactory { @OptIn(ObsoleteDescriptorBasedAPI::class) class IrDescriptorBasedFunctionFactory( - private val irBuiltIns: IrBuiltInsOverDescriptors, private val symbolTable: SymbolTable + private val irBuiltIns: IrBuiltInsOverDescriptors, + private val symbolTable: SymbolTable, + getPackageFragment: ((PackageFragmentDescriptor) -> IrPackageFragment)? = null ) : IrAbstractDescriptorBasedFunctionFactory() { + val getPackageFragment = + getPackageFragment ?: symbolTable::declareExternalPackageFragmentIfNotExists // TODO: Lazieness @@ -230,18 +234,18 @@ class IrDescriptorBasedFunctionFactory( private val kotlinPackageFragment: IrPackageFragment by lazy { irBuiltIns.builtIns.getFunction(0).let { - symbolTable.declareExternalPackageFragmentIfNotExists(it.containingDeclaration as PackageFragmentDescriptor) + getPackageFragment(it.containingDeclaration as PackageFragmentDescriptor) } } private val kotlinCoroutinesPackageFragment: IrPackageFragment by lazy { irBuiltIns.builtIns.getSuspendFunction(0).let { - symbolTable.declareExternalPackageFragmentIfNotExists(it.containingDeclaration as PackageFragmentDescriptor) + getPackageFragment(it.containingDeclaration as PackageFragmentDescriptor) } } private val kotlinReflectPackageFragment: IrPackageFragment by lazy { irBuiltIns.kPropertyClass.descriptor.let { - symbolTable.declareExternalPackageFragmentIfNotExists(it.containingDeclaration as PackageFragmentDescriptor) + getPackageFragment(it.containingDeclaration as PackageFragmentDescriptor) } } diff --git a/compiler/ir/serialization.js/src/org/jetbrains/kotlin/ir/backend/js/klib.kt b/compiler/ir/serialization.js/src/org/jetbrains/kotlin/ir/backend/js/klib.kt index 9959846a05c..ac89418744f 100644 --- a/compiler/ir/serialization.js/src/org/jetbrains/kotlin/ir/backend/js/klib.kt +++ b/compiler/ir/serialization.js/src/org/jetbrains/kotlin/ir/backend/js/klib.kt @@ -26,6 +26,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.config.* import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.ModuleDescriptor +import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.ir.IrBuiltIns @@ -38,13 +39,12 @@ import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsManglerDesc import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsManglerIr import org.jetbrains.kotlin.ir.declarations.IrFactory import org.jetbrains.kotlin.ir.declarations.IrModuleFragment +import org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl import org.jetbrains.kotlin.ir.descriptors.IrBuiltInsOverDescriptors +import org.jetbrains.kotlin.ir.descriptors.IrDescriptorBasedFunctionFactory import org.jetbrains.kotlin.ir.linkage.IrDeserializer import org.jetbrains.kotlin.ir.symbols.IrSymbol -import org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator -import org.jetbrains.kotlin.ir.util.IrMessageLogger -import org.jetbrains.kotlin.ir.util.SymbolTable -import org.jetbrains.kotlin.ir.util.noUnboundLeft +import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.acceptVoid import org.jetbrains.kotlin.js.analyzer.JsAnalysisResult import org.jetbrains.kotlin.js.config.ErrorTolerancePolicy @@ -256,7 +256,8 @@ fun loadIr( depsDescriptors: ModulesStructure, irFactory: IrFactory, verifySignatures: Boolean, - filesToLoad: Set? = null + filesToLoad: Set? = null, + loadFunctionInterfacesIntoStdlib: Boolean = false, ): IrModuleInfo { val project = depsDescriptors.project val mainModule = depsDescriptors.mainModule @@ -268,11 +269,26 @@ fun loadIr( val signaturer = IdSignatureDescriptor(JsManglerDesc) val symbolTable = SymbolTable(signaturer, irFactory) + lateinit var stdlibModule: IrModuleFragment + + val createFunctionFactoryCallback = + if (loadFunctionInterfacesIntoStdlib) { + { packageFragmentDescriptor: PackageFragmentDescriptor -> + IrFileImpl(NaiveSourceBasedFileEntryImpl("[K][Suspend]Functions"), packageFragmentDescriptor, stdlibModule) + .also { stdlibModule.files += it } + } + } else { + null + } + when (mainModule) { is MainModule.SourceFiles -> { assert(filesToLoad == null) val (psi2IrContext, _) = preparePsi2Ir(depsDescriptors, errorPolicy, symbolTable) val irBuiltIns = psi2IrContext.irBuiltIns + (irBuiltIns as IrBuiltInsOverDescriptors).functionFactory = + IrDescriptorBasedFunctionFactory(irBuiltIns, symbolTable, createFunctionFactoryCallback) + val feContext = psi2IrContext.run { JsIrLinker.JsFePluginContext(moduleDescriptor, symbolTable, typeTranslator, irBuiltIns) } @@ -301,6 +317,7 @@ fun loadIr( } } } + stdlibModule = deserializedModuleFragments.first() val moduleFragment = psi2IrContext.generateModuleFragmentWithPlugins(project, mainModule.files, irLinker, messageLogger) symbolTable.noUnboundLeft("Unbound symbols left after linker") @@ -332,6 +349,7 @@ fun loadIr( val typeTranslator = TypeTranslatorImpl(symbolTable, depsDescriptors.compilerConfiguration.languageVersionSettings, moduleDescriptor) val irBuiltIns = IrBuiltInsOverDescriptors(moduleDescriptor.builtIns, typeTranslator, symbolTable) + irBuiltIns.functionFactory = IrDescriptorBasedFunctionFactory(irBuiltIns, symbolTable, createFunctionFactoryCallback) val loweredIcData = if (!depsDescriptors.icUseStdlibCache && !depsDescriptors.icUseStdlibCache) emptyMap() else { val result = mutableMapOf() @@ -390,6 +408,7 @@ fun loadIr( } } } + stdlibModule = deserializedModuleFragments.first() val moduleFragment = deserializedModuleFragments.last() diff --git a/compiler/testData/codegen/box/callableReference/adaptedReferences/largeVararg.kt b/compiler/testData/codegen/box/callableReference/adaptedReferences/largeVararg.kt index 0aaa19e2a4d..ca32a3a831b 100644 --- a/compiler/testData/codegen/box/callableReference/adaptedReferences/largeVararg.kt +++ b/compiler/testData/codegen/box/callableReference/adaptedReferences/largeVararg.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: BIG_ARITY // !LANGUAGE: +NewInference fun foo( diff --git a/compiler/testData/codegen/box/callableReference/function/referenceToCompanionMember.kt b/compiler/testData/codegen/box/callableReference/function/referenceToCompanionMember.kt index 88111ba6cec..d26d4b302be 100644 --- a/compiler/testData/codegen/box/callableReference/function/referenceToCompanionMember.kt +++ b/compiler/testData/codegen/box/callableReference/function/referenceToCompanionMember.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: FUNCTION_REFERENCES // WITH_RUNTIME // IGNORE_BACKEND: JS diff --git a/compiler/testData/codegen/box/callableReference/function/topLevelFromTopLevelUnitManyArgs.kt b/compiler/testData/codegen/box/callableReference/function/topLevelFromTopLevelUnitManyArgs.kt index e6257020cf2..a154316a52b 100644 --- a/compiler/testData/codegen/box/callableReference/function/topLevelFromTopLevelUnitManyArgs.kt +++ b/compiler/testData/codegen/box/callableReference/function/topLevelFromTopLevelUnitManyArgs.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: BIG_ARITY // IGNORE_BACKEND: NATIVE var result = "Fail" diff --git a/compiler/testData/codegen/box/functions/bigArity/function255.kt b/compiler/testData/codegen/box/functions/bigArity/function255.kt index 3666a894d18..16fdf6c2c9e 100644 --- a/compiler/testData/codegen/box/functions/bigArity/function255.kt +++ b/compiler/testData/codegen/box/functions/bigArity/function255.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: BIG_ARITY // !LANGUAGE: +FunctionTypesWithBigArity class A(val value: Int) { diff --git a/compiler/testData/codegen/box/functions/bigArity/instanceOfCallableReference.kt b/compiler/testData/codegen/box/functions/bigArity/instanceOfCallableReference.kt index f32b2f06031..a1525050d14 100644 --- a/compiler/testData/codegen/box/functions/bigArity/instanceOfCallableReference.kt +++ b/compiler/testData/codegen/box/functions/bigArity/instanceOfCallableReference.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: BIG_ARITY // !LANGUAGE: +FunctionTypesWithBigArity // IGNORE_BACKEND: JS_IR, JS // IGNORE_BACKEND: JS_IR_ES6 diff --git a/compiler/testData/codegen/box/functions/bigArity/invokeCallableReference.kt b/compiler/testData/codegen/box/functions/bigArity/invokeCallableReference.kt index 701022cb969..c9509a07ba5 100644 --- a/compiler/testData/codegen/box/functions/bigArity/invokeCallableReference.kt +++ b/compiler/testData/codegen/box/functions/bigArity/invokeCallableReference.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: BIG_ARITY // !LANGUAGE: +FunctionTypesWithBigArity class A diff --git a/compiler/testData/codegen/box/functions/bigArity/invokeLambda.kt b/compiler/testData/codegen/box/functions/bigArity/invokeLambda.kt index c5142e3d789..afb24c958db 100644 --- a/compiler/testData/codegen/box/functions/bigArity/invokeLambda.kt +++ b/compiler/testData/codegen/box/functions/bigArity/invokeLambda.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: BIG_ARITY // !LANGUAGE: +FunctionTypesWithBigArity class A(val value: Int) diff --git a/compiler/testData/codegen/box/functions/bigArity/invokeMemberCallableReference.kt b/compiler/testData/codegen/box/functions/bigArity/invokeMemberCallableReference.kt index 850c7a3a8fd..743865b5b4d 100644 --- a/compiler/testData/codegen/box/functions/bigArity/invokeMemberCallableReference.kt +++ b/compiler/testData/codegen/box/functions/bigArity/invokeMemberCallableReference.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: BIG_ARITY // !LANGUAGE: +FunctionTypesWithBigArity class A { diff --git a/compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt b/compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt index ce8a6c6b9b1..7a80c893d32 100644 --- a/compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt +++ b/compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: BIG_ARITY interface A object O : A diff --git a/compiler/testData/codegen/box/inlineClasses/kt45084.kt b/compiler/testData/codegen/box/inlineClasses/kt45084.kt index 58e99923f2a..636a9456d87 100644 --- a/compiler/testData/codegen/box/inlineClasses/kt45084.kt +++ b/compiler/testData/codegen/box/inlineClasses/kt45084.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: WASM inline class Z(val value: Long) diff --git a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/Function0.kt b/libraries/stdlib/wasm/internal/kotlin/wasm/internal/Function0.kt deleted file mode 100644 index e542e4ee725..00000000000 --- a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/Function0.kt +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -@file:Suppress("unused") - -package kotlin.wasm.internal - -/** A function that takes 0 arguments. */ -public interface Function0 : Function { - /** Invokes the function. */ - public operator fun invoke(): R -} - -/** A function that takes 1 argument. */ -public interface Function1 : Function { - /** Invokes the function with the specified argument. */ - public operator fun invoke(p1: P1): R -} - -/** A function that takes 2 arguments. */ -public interface Function2 : Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke(p1: P1, p2: P2): R -} - -/** A function that takes 3 arguments. */ -public interface Function3 : Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke(p1: P1, p2: P2, p3: P3): R -} - -/** A function that takes 4 arguments. */ -public interface Function4 : Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4): R -} - -/** A function that takes 5 arguments. */ -public interface Function5 : Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5): R -} - -/** A function that takes 6 arguments. */ -public interface Function6 : Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6): R -} - -/** A function that takes 7 arguments. */ -public interface Function7 : Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7): R -} - -/** A function that takes 8 arguments. */ -public interface Function8 : Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8): R -} - -/** A function that takes 9 arguments. */ -public interface Function9 : Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9): R -} - -/** A function that takes 10 arguments. */ -public interface Function10 : Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10): R -} - -/** A function that takes 11 arguments. */ -public interface Function11 : Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11): R -} - -/** A function that takes 12 arguments. */ -public interface Function12 : Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10, p11: P11, p12: P12): R -} - -/** A function that takes 13 arguments. */ -public interface Function13 : - Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke( - p1: P1, - p2: P2, - p3: P3, - p4: P4, - p5: P5, - p6: P6, - p7: P7, - p8: P8, - p9: P9, - p10: P10, - p11: P11, - p12: P12, - p13: P13 - ): R -} - -/** A function that takes 14 arguments. */ -public interface Function14 : - Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke( - p1: P1, - p2: P2, - p3: P3, - p4: P4, - p5: P5, - p6: P6, - p7: P7, - p8: P8, - p9: P9, - p10: P10, - p11: P11, - p12: P12, - p13: P13, - p14: P14 - ): R -} - -/** A function that takes 15 arguments. */ -public interface Function15 : - Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke( - p1: P1, - p2: P2, - p3: P3, - p4: P4, - p5: P5, - p6: P6, - p7: P7, - p8: P8, - p9: P9, - p10: P10, - p11: P11, - p12: P12, - p13: P13, - p14: P14, - p15: P15 - ): R -} - -/** A function that takes 16 arguments. */ -public interface Function16 : - Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke( - p1: P1, - p2: P2, - p3: P3, - p4: P4, - p5: P5, - p6: P6, - p7: P7, - p8: P8, - p9: P9, - p10: P10, - p11: P11, - p12: P12, - p13: P13, - p14: P14, - p15: P15, - p16: P16 - ): R -} - -/** A function that takes 17 arguments. */ -public interface Function17 : - Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke( - p1: P1, - p2: P2, - p3: P3, - p4: P4, - p5: P5, - p6: P6, - p7: P7, - p8: P8, - p9: P9, - p10: P10, - p11: P11, - p12: P12, - p13: P13, - p14: P14, - p15: P15, - p16: P16, - p17: P17 - ): R -} - -/** A function that takes 18 arguments. */ -public interface Function18 : - Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke( - p1: P1, - p2: P2, - p3: P3, - p4: P4, - p5: P5, - p6: P6, - p7: P7, - p8: P8, - p9: P9, - p10: P10, - p11: P11, - p12: P12, - p13: P13, - p14: P14, - p15: P15, - p16: P16, - p17: P17, - p18: P18 - ): R -} - -/** A function that takes 19 arguments. */ -public interface Function19 : - Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke( - p1: P1, - p2: P2, - p3: P3, - p4: P4, - p5: P5, - p6: P6, - p7: P7, - p8: P8, - p9: P9, - p10: P10, - p11: P11, - p12: P12, - p13: P13, - p14: P14, - p15: P15, - p16: P16, - p17: P17, - p18: P18, - p19: P19 - ): R -} - -/** A function that takes 20 arguments. */ -public interface Function20 : - Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke( - p1: P1, - p2: P2, - p3: P3, - p4: P4, - p5: P5, - p6: P6, - p7: P7, - p8: P8, - p9: P9, - p10: P10, - p11: P11, - p12: P12, - p13: P13, - p14: P14, - p15: P15, - p16: P16, - p17: P17, - p18: P18, - p19: P19, - p20: P20 - ): R -} - -/** A function that takes 21 arguments. */ -public interface Function21 : - Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke( - p1: P1, - p2: P2, - p3: P3, - p4: P4, - p5: P5, - p6: P6, - p7: P7, - p8: P8, - p9: P9, - p10: P10, - p11: P11, - p12: P12, - p13: P13, - p14: P14, - p15: P15, - p16: P16, - p17: P17, - p18: P18, - p19: P19, - p20: P20, - p21: P21 - ): R -} - -/** A function that takes 22 arguments. */ -public interface Function22 : - Function { - /** Invokes the function with the specified arguments. */ - public operator fun invoke( - p1: P1, - p2: P2, - p3: P3, - p4: P4, - p5: P5, - p6: P6, - p7: P7, - p8: P8, - p9: P9, - p10: P10, - p11: P11, - p12: P12, - p13: P13, - p14: P14, - p15: P15, - p16: P16, - p17: P17, - p18: P18, - p19: P19, - p20: P20, - p21: P21, - p22: P22 - ): R -}