Made [K][Suspend]FunctionN autogenerated

This commit is contained in:
Igor Chevdar
2019-08-02 14:33:45 +03:00
parent 5d6d05b5f9
commit 6c377aa69f
19 changed files with 273 additions and 390 deletions
@@ -0,0 +1,194 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package org.jetbrains.kotlin.backend.konan
import org.jetbrains.kotlin.backend.common.ir.*
import org.jetbrains.kotlin.backend.konan.descriptors.findPackage
import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.*
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrClassSymbolImpl
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.classOrNull
import org.jetbrains.kotlin.ir.types.defaultType
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.util.OperatorNameConventions
internal object DECLARATION_ORIGIN_FUNCTION_CLASS : IrDeclarationOriginImpl("DECLARATION_ORIGIN_FUNCTION_CLASS")
internal class BuiltInFictitiousFunctionIrClassFactory(
var symbolTable: SymbolTable?,
private val irBuiltIns: IrBuiltIns,
private val reflectionTypes: KonanReflectionTypes
) : IrProvider {
override fun getDeclaration(symbol: IrSymbol) =
(symbol.descriptor as? FunctionClassDescriptor)?.let { buildClass(it) }
var module: IrModuleFragment? = null
set(value) {
if (value == null)
error("Provide a valid non-null module")
if (field != null)
error("Module has already been set")
field = value
value.files += filesMap.values
builtClasses.forEach { it.addFakeOverrides() }
}
class FunctionalInterface(val irClass: IrClass, val arity: Int)
fun function(n: Int) = buildClass(irBuiltIns.builtIns.getFunction(n) as FunctionClassDescriptor)
fun kFunction(n: Int) = buildClass(reflectionTypes.getKFunction(n) as FunctionClassDescriptor)
fun suspendFunction(n: Int) = buildClass(irBuiltIns.builtIns.getSuspendFunction(n) as FunctionClassDescriptor)
fun kSuspendFunction(n: Int) = buildClass(reflectionTypes.getKSuspendFunction(n) as FunctionClassDescriptor)
private val functionSymbol = symbolTable!!.referenceClass(
irBuiltIns.builtIns.builtInsModule.findClassAcrossModuleDependencies(
ClassId.topLevel(KonanFqNames.function))!!)
private val kFunctionSymbol = symbolTable!!.referenceClass(
irBuiltIns.builtIns.builtInsModule.findClassAcrossModuleDependencies(
ClassId.topLevel(KonanFqNames.kFunction))!!)
private val filesMap = mutableMapOf<PackageFragmentDescriptor, IrFile>()
private val builtClassesMap = mutableMapOf<FunctionClassDescriptor, IrClass>()
val builtClasses get() = builtClassesMap.values
val builtFunctionNClasses get() =
builtClassesMap.values
.filter { (it.descriptor as FunctionClassDescriptor).functionKind == FunctionClassDescriptor.Kind.Function }
.map { FunctionalInterface(it, (it.descriptor as FunctionClassDescriptor).arity) }
private fun createTypeParameter(descriptor: TypeParameterDescriptor) =
symbolTable?.declareGlobalTypeParameter(
SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, DECLARATION_ORIGIN_FUNCTION_CLASS,
descriptor
)
?: IrTypeParameterImpl(
SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, DECLARATION_ORIGIN_FUNCTION_CLASS,
descriptor
)
private fun createSimpleFunction(
descriptor: FunctionDescriptor,
origin: IrDeclarationOrigin,
returnType: IrType
) = symbolTable?.declareSimpleFunction(
SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, origin,
descriptor
) {
IrFunctionImpl(
SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, origin,
it,
returnType
)
}
?: IrFunctionImpl(
SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, origin,
descriptor,
returnType
)
private fun createClass(descriptor: FunctionClassDescriptor) =
symbolTable?.declareClass(
SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, DECLARATION_ORIGIN_FUNCTION_CLASS,
descriptor
)
?: IrClassImpl(
SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, DECLARATION_ORIGIN_FUNCTION_CLASS,
IrClassSymbolImpl(descriptor)
)
private fun buildClass(descriptor: FunctionClassDescriptor): IrClass =
builtClassesMap.getOrPut(descriptor) {
createClass(descriptor).apply {
val functionClass = this
descriptor.declaredTypeParameters.mapTo(typeParameters) { typeParameterDescriptor ->
createTypeParameter(typeParameterDescriptor).also {
it.parent = this
it.superTypes += irBuiltIns.anyNType
}
}
val descriptorToIrParametersMap = typeParameters.map { it.descriptor to it }.toMap()
descriptor.typeConstructor.supertypes.mapTo(superTypes) { superType ->
val arguments = superType.arguments.map { argument ->
val argumentClassifierDescriptor = argument.type.constructor.declarationDescriptor
val argumentClassifierSymbol = argumentClassifierDescriptor?.let { descriptorToIrParametersMap[it] }
?: error("Unexpected super type argument: $argumentClassifierDescriptor")
makeTypeProjection(argumentClassifierSymbol.defaultType, argument.projectionKind)
}
val superTypeSymbol = when (val superTypeDescriptor = superType.constructor.declarationDescriptor) {
is FunctionClassDescriptor -> buildClass(superTypeDescriptor).symbol
functionSymbol.descriptor -> functionSymbol
kFunctionSymbol.descriptor -> kFunctionSymbol
else -> error("Unexpected super type: $superTypeDescriptor")
}
IrSimpleTypeImpl(superTypeSymbol, superType.isMarkedNullable, arguments, emptyList())
}
createParameterDeclarations()
val invokeFunctionDescriptor = descriptor.unsubstitutedMemberScope.getContributedFunctions(
OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND).single()
val isFakeOverride = invokeFunctionDescriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE
val invokeFunctionOrigin =
if (isFakeOverride)
IrDeclarationOrigin.FAKE_OVERRIDE
else
DECLARATION_ORIGIN_FUNCTION_CLASS
declarations += createSimpleFunction(
invokeFunctionDescriptor, invokeFunctionOrigin,
typeParameters.last().defaultType
).apply {
parent = functionClass
invokeFunctionDescriptor.valueParameters.mapTo(valueParameters) {
IrValueParameterImpl(
SYNTHETIC_OFFSET, SYNTHETIC_OFFSET,
invokeFunctionOrigin,
it,
functionClass.typeParameters[it.index].defaultType,
null
).also { it.parent = this }
}
if (!isFakeOverride)
createDispatchReceiverParameter(invokeFunctionOrigin)
else {
val overriddenFunction = superTypes
.mapNotNull { it.classOrNull?.owner }
.single { it.descriptor is FunctionClassDescriptor }
.simpleFunctions()
.single { it.name == OperatorNameConventions.INVOKE }
overriddenSymbols += overriddenFunction.symbol
dispatchReceiverParameter = overriddenFunction.dispatchReceiverParameter?.copyTo(this)
}
}
// Unfortunately, addFakeOverrides() uses some parents but they are only set after PsiToIr phase.
// So we add all the fake overrides only when we're supplied with the module (this is done after PsiToIr).
if (this@BuiltInFictitiousFunctionIrClassFactory.module != null)
addFakeOverrides()
val packageFragmentDescriptor = descriptor.findPackage()
val file = filesMap.getOrPut(packageFragmentDescriptor) {
IrFileImpl(NaiveSourceBasedFileEntryImpl("[K][Suspend]Functions"), packageFragmentDescriptor).also {
this@BuiltInFictitiousFunctionIrClassFactory.module?.files?.add(it)
}
}
parent = file
file.declarations += this
}
}
}
@@ -13,6 +13,8 @@ internal const val NATIVE_PTR_NAME = "NativePtr"
internal const val NON_NULL_NATIVE_PTR_NAME = "NonNullNativePtr"
object KonanFqNames {
val function = FqName("kotlin.Function")
val kFunction = FqName("kotlin.reflect.KFunction")
val packageName = FqName("kotlin.native")
val internalPackageName = FqName("kotlin.native.internal")
val nativePtr = internalPackageName.child(Name.identifier(NATIVE_PTR_NAME)).toUnsafe()
@@ -24,8 +26,3 @@ object KonanFqNames {
val typedIntrinsic = FqName("kotlin.native.internal.TypedIntrinsic")
val objCMethod = FqName("kotlinx.cinterop.ObjCMethod")
}
/**
* Maximum number of parameters supported in function types (e.g. `FunctionXX`, `KFunctionXX`, `SuspendFunctionXX`).
*/
internal const val KONAN_FUNCTION_INTERFACES_MAX_PARAMETERS = 22
@@ -7,12 +7,14 @@ package org.jetbrains.kotlin.backend.konan
import org.jetbrains.kotlin.analyzer.AnalysisResult
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.functions.functionInterfacePackageFragmentProvider
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.container.get
import org.jetbrains.kotlin.context.ModuleContext
import org.jetbrains.kotlin.context.MutableModuleContextImpl
import org.jetbrains.kotlin.context.ProjectContext
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.descriptors.konan.CurrentKonanModuleOrigin
import org.jetbrains.kotlin.descriptors.konan.isKonanStdlib
@@ -47,22 +49,26 @@ internal object TopDownAnalyzerFacadeForKonan {
config.languageVersionSettings,
config.friendModuleFiles)
val additionalPackages = mutableListOf<PackageFragmentProvider>()
if (!module.isKonanStdlib()) {
val dependencies = listOf(module) + resolvedDependencies.moduleDescriptors.resolvedDescriptors + resolvedDependencies.moduleDescriptors.forwardDeclarationsModule
module.setDependencies(dependencies, resolvedDependencies.friends)
} else {
assert (resolvedDependencies.moduleDescriptors.resolvedDescriptors.isEmpty())
moduleContext.setDependencies(module)
// [K][Suspend]FunctionN belong to stdlib.
additionalPackages += functionInterfacePackageFragmentProvider(projectContext.storageManager, module)
}
return analyzeFilesWithGivenTrace(files, BindingTraceContext(), moduleContext, context)
return analyzeFilesWithGivenTrace(files, BindingTraceContext(), moduleContext, context, additionalPackages)
}
fun analyzeFilesWithGivenTrace(
files: Collection<KtFile>,
trace: BindingTrace,
moduleContext: ModuleContext,
context: Context
context: Context,
additionalPackages: List<PackageFragmentProvider> = emptyList()
): AnalysisResult {
// we print out each file we compile if frontend phase is verbose
@@ -73,7 +79,8 @@ internal object TopDownAnalyzerFacadeForKonan {
val analyzerForKonan = createTopDownAnalyzerProviderForKonan(
moduleContext, trace,
FileBasedDeclarationProviderFactory(moduleContext.storageManager, files),
context.config.configuration.get(CommonConfigurationKeys.LANGUAGE_VERSION_SETTINGS)!!
context.config.configuration.get(CommonConfigurationKeys.LANGUAGE_VERSION_SETTINGS)!!,
additionalPackages
) {
initContainer(context.config)
}.apply {
@@ -10,13 +10,11 @@ import org.jetbrains.kotlin.backend.konan.ir.KonanSymbols
import org.jetbrains.kotlin.backend.konan.llvm.*
import org.jetbrains.kotlin.backend.konan.lower.ExpectToActualDefaultValueCopier
import org.jetbrains.kotlin.backend.konan.objcexport.ObjCExport
import org.jetbrains.kotlin.backend.konan.serialization.KonanDeclarationTable
import org.jetbrains.kotlin.backend.konan.serialization.KonanIrLinker
import org.jetbrains.kotlin.backend.konan.serialization.KonanIrModuleSerializer
import org.jetbrains.kotlin.backend.konan.serialization.KonanSerializationUtil
import org.jetbrains.kotlin.backend.konan.serialization.*
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.descriptors.konan.isKonanStdlib
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.util.SymbolTable
@@ -159,12 +157,19 @@ internal val psiToIrPhase = konanUnitPhase(
dependenciesCount = dependencies.size
}
val symbols = KonanSymbols(this, symbolTable, symbolTable.lazyWrapper)
val module = translator.generateModuleFragment(generatorContext, environment.getSourceFiles(), deserializer)
val functionIrClassFactory = BuiltInFictitiousFunctionIrClassFactory(
symbolTable, generatorContext.irBuiltIns, reflectionTypes)
val symbols = KonanSymbols(this, symbolTable, symbolTable.lazyWrapper, functionIrClassFactory)
val module = translator.generateModuleFragment(generatorContext, environment.getSourceFiles(),
deserializer, listOf(functionIrClassFactory))
irModule = module
irModules = deserializer.modules
ir.symbols = symbols
functionIrClassFactory.module =
(listOf(irModule!!) + irModules.values)
.single { it.descriptor.isKonanStdlib() }
},
name = "Psi2Ir",
description = "Psi to IR conversion",
@@ -174,6 +179,7 @@ internal val psiToIrPhase = konanUnitPhase(
internal val destroySymbolTablePhase = konanUnitPhase(
op = {
this.symbolTable = null // TODO: invalidate symbolTable itself.
ir.symbols.functionIrClassFactory.symbolTable = null
},
name = "DestroySymbolTable",
description = "Destroy SymbolTable",
@@ -710,7 +710,7 @@ private fun KotlinStubs.mapBlockType(
location: TypeLocation
): ObjCBlockPointerValuePassing {
type as IrSimpleType
require(type.classifier == symbols.functions[type.arguments.size - 1])
require(type.classifier == symbols.functionN(type.arguments.size - 1))
val returnTypeArgument = type.arguments.last()
val valueReturning = when (returnTypeArgument) {
is IrTypeProjection -> if (returnTypeArgument.variance == Variance.INVARIANT) {
@@ -7,6 +7,8 @@ package org.jetbrains.kotlin.backend.konan
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.container.*
import org.jetbrains.kotlin.context.ModuleContext
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
import org.jetbrains.kotlin.descriptors.impl.CompositePackageFragmentProvider
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.frontend.di.configureModule
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
@@ -22,6 +24,7 @@ fun createTopDownAnalyzerProviderForKonan(
bindingTrace: BindingTrace,
declarationProviderFactory: DeclarationProviderFactory,
languageVersionSettings: LanguageVersionSettings,
additionalPackages: List<PackageFragmentProvider>,
initContainer: StorageComponentContainer.() -> Unit
): ComponentProvider {
return createContainer("TopDownAnalyzerForKonan", NativePlatformAnalyzerServices) {
@@ -37,6 +40,9 @@ fun createTopDownAnalyzerProviderForKonan(
initContainer()
}.apply {
get<ModuleDescriptorImpl>().initialize(get<KotlinCodeAnalyzer>().packageFragmentProvider)
val packagePartProviders = mutableListOf(get<KotlinCodeAnalyzer>().packageFragmentProvider)
val moduleDescriptor = get<ModuleDescriptorImpl>()
packagePartProviders += additionalPackages
moduleDescriptor.initialize(CompositePackageFragmentProvider(packagePartProviders))
}
}
@@ -40,7 +40,12 @@ internal class KonanIr(context: Context, irModule: IrModuleFragment): Ir<Context
override var symbols: KonanSymbols by Delegates.notNull()
}
internal class KonanSymbols(context: Context, private val symbolTable: SymbolTable, lazySymbolTable: ReferenceSymbolTable): Symbols<Context>(context, lazySymbolTable) {
internal class KonanSymbols(
context: Context,
private val symbolTable: SymbolTable,
lazySymbolTable: ReferenceSymbolTable,
val functionIrClassFactory: BuiltInFictitiousFunctionIrClassFactory
): Symbols<Context>(context, lazySymbolTable) {
val entryPoint = findMainEntryPoint(context)?.let { symbolTable.referenceSimpleFunction(it) }
@@ -481,23 +486,16 @@ internal class KonanSymbols(context: Context, private val symbolTable: SymbolTab
.getContributedClassifier(Name.identifier(name), NoLookupLocation.FROM_BACKEND) as ClassDescriptor
)
val functions = (0 .. KONAN_FUNCTION_INTERFACES_MAX_PARAMETERS)
.map { symbolTable.referenceClass(builtIns.getFunction(it)) }
override fun functionN(n: Int) = functionIrClassFactory.function(n).symbol
val kFunctions = (0 .. KONAN_FUNCTION_INTERFACES_MAX_PARAMETERS)
.map { symbolTable.referenceClass(context.reflectionTypes.getKFunction(it)) }
override fun suspendFunctionN(n: Int) = functionIrClassFactory.suspendFunction(n).symbol
// Since KSuspendFunctionN inherits Function{N+1} and we only have 0..22 range, skip the last one for now.
val kSuspendFunctions = (0 .. KONAN_FUNCTION_INTERFACES_MAX_PARAMETERS - 1)
.map { symbolTable.referenceClass(context.reflectionTypes.getKSuspendFunction(it)) }
fun kFunctionN(n: Int) = functionIrClassFactory.kFunction(n).symbol
fun getKFunctionType(returnType: IrType, parameterTypes: List<IrType>): IrType {
val kFunctionClassSymbol = kFunctions[parameterTypes.size]
return kFunctionClassSymbol.typeWith(parameterTypes + returnType)
}
fun kSuspendFunctionN(n: Int) = functionIrClassFactory.kSuspendFunction(n).symbol
val suspendFunctions = (0 .. KONAN_FUNCTION_INTERFACES_MAX_PARAMETERS)
.map { symbolTable.referenceClass(builtIns.getSuspendFunction(it)) }
fun getKFunctionType(returnType: IrType, parameterTypes: List<IrType>) =
kFunctionN(parameterTypes.size).typeWith(parameterTypes + returnType)
val baseClassSuite = getKonanTestClass("BaseClassSuite")
val topLevelSuite = getKonanTestClass("TopLevelSuite")
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.backend.konan.llvm.objcexport
import llvm.*
import org.jetbrains.kotlin.backend.common.ir.simpleFunctions
import org.jetbrains.kotlin.backend.konan.llvm.*
import org.jetbrains.kotlin.backend.konan.objcexport.BlockPointerBridge
import org.jetbrains.kotlin.descriptors.konan.CurrentKonanModuleOrigin
@@ -15,7 +16,7 @@ import org.jetbrains.kotlin.util.OperatorNameConventions
internal fun ObjCExportCodeGenerator.generateBlockToKotlinFunctionConverter(
bridge: BlockPointerBridge
): LLVMValueRef {
val irInterface = symbols.functions[bridge.numberOfParameters].owner
val irInterface = symbols.functionN(bridge.numberOfParameters).owner
val invokeMethod = irInterface.declarations.filterIsInstance<IrSimpleFunction>()
.single { it.name == OperatorNameConventions.INVOKE }
@@ -231,8 +232,8 @@ internal class BlockAdapterToFunctionGenerator(val objCExportCodeGenerator: ObjC
objCReferenceToKotlin(param(index), Lifetime.ARGUMENT)
}
val invokeMethod = context.ir.symbols.functions[numberOfParameters].owner.declarations
.filterIsInstance<IrSimpleFunction>().single { it.name == OperatorNameConventions.INVOKE }
val invokeMethod = context.ir.symbols.functionN(numberOfParameters).owner.simpleFunctions()
.single { it.name == OperatorNameConventions.INVOKE }
val callee = lookupVirtualImpl(kotlinFunction, invokeMethod)
@@ -461,15 +461,15 @@ private fun ObjCExportCodeGenerator.emitBoxConverter(
}
private fun ObjCExportCodeGenerator.emitFunctionConverters() {
(0 .. ObjCExportMapper.maxFunctionTypeParameterCount).forEach { numberOfParameters ->
val converter = kotlinFunctionToBlockConverter(BlockPointerBridge(numberOfParameters, returnsVoid = false))
setObjCExportTypeInfo(symbols.functions[numberOfParameters].owner, constPointer(converter))
context.ir.symbols.functionIrClassFactory.builtFunctionNClasses.forEach { functionClass ->
val converter = kotlinFunctionToBlockConverter(BlockPointerBridge(functionClass.arity, returnsVoid = false))
setObjCExportTypeInfo(functionClass.irClass, constPointer(converter))
}
}
private fun ObjCExportCodeGenerator.emitBlockToKotlinFunctionConverters() {
val converters = (0 .. ObjCExportMapper.maxFunctionTypeParameterCount).map {
val bridge = BlockPointerBridge(numberOfParameters = it, returnsVoid = false)
val converters = context.ir.symbols.functionIrClassFactory.builtFunctionNClasses.map {
val bridge = BlockPointerBridge(numberOfParameters = it.arity, returnsVoid = false)
constPointer(blockToKotlinFunctionConverter(bridge))
}
val ptr = staticData.placeGlobalArray(
@@ -201,10 +201,10 @@ internal class CallableReferenceLowering(val context: Context): FileLoweringPass
val suspendFunctionClass: IrClass?
if (isKSuspendFunction) {
superTypes += kSuspendFunctionImplSymbol.typeWith(referencedFunction.returnType)
functionClass = symbols.functions[numberOfParameters + 1].owner
functionClass = symbols.functionN(numberOfParameters + 1).owner
val continuationType = continuationClassSymbol.typeWith(referencedFunction.returnType)
superTypes += functionClass.typeWith(functionParameterTypes + continuationType + irBuiltIns.anyNType)
suspendFunctionClass = symbols.kSuspendFunctions[numberOfParameters].owner
suspendFunctionClass = symbols.kSuspendFunctionN(numberOfParameters).owner
superTypes += suspendFunctionClass.typeWith(functionParameterTypes + referencedFunction.returnType)
}
else {
@@ -212,7 +212,7 @@ internal class CallableReferenceLowering(val context: Context): FileLoweringPass
kFunctionImplSymbol.typeWith(referencedFunction.returnType)
else
irBuiltIns.anyType
functionClass = (if (isKFunction) symbols.kFunctions else symbols.functions)[numberOfParameters].owner
functionClass = (if (isKFunction) symbols.kFunctionN(numberOfParameters) else symbols.functionN(numberOfParameters)).owner
superTypes += functionClass.typeWith(functionParameterTypes + referencedFunction.returnType)
val lastParameterType = unboundFunctionParameters.lastOrNull()?.type
if (lastParameterType?.classifierOrNull != continuationClassSymbol)
@@ -220,7 +220,7 @@ internal class CallableReferenceLowering(val context: Context): FileLoweringPass
else {
lastParameterType as IrSimpleType
// If the last parameter is Continuation<> inherit from SuspendFunction.
suspendFunctionClass = symbols.suspendFunctions[numberOfParameters - 1].owner
suspendFunctionClass = symbols.suspendFunctionN(numberOfParameters - 1).owner
val suspendFunctionClassTypeParameters = functionParameterTypes.dropLast(1) +
(lastParameterType.arguments.single().typeOrNull ?: irBuiltIns.anyNType)
superTypes += suspendFunctionClass.symbol.typeWith(suspendFunctionClassTypeParameters)
@@ -27,10 +27,6 @@ internal class ObjCExportMapper(
internal val deprecationResolver: DeprecationResolver? = null,
private val local: Boolean = false
) {
companion object {
val maxFunctionTypeParameterCount get() = KONAN_FUNCTION_INTERFACES_MAX_PARAMETERS
}
fun getCustomTypeMapper(descriptor: ClassDescriptor): CustomTypeMapper? = CustomTypeMappers.getMapper(descriptor)
val hiddenTypes: Set<ClassId> get() = CustomTypeMappers.hiddenTypes
@@ -17,7 +17,6 @@ import org.jetbrains.kotlin.backend.konan.descriptors.target
import org.jetbrains.kotlin.backend.konan.ir.*
import org.jetbrains.kotlin.backend.konan.llvm.functionName
import org.jetbrains.kotlin.backend.konan.llvm.localHash
import org.jetbrains.kotlin.backend.konan.llvm.longName
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
@@ -410,8 +409,8 @@ internal class ModuleDFGBuilder(val context: Context, val irModule: IrModuleFrag
private val createUninitializedInstanceSymbol = symbols.createUninitializedInstance
private val initInstanceSymbol = symbols.initInstance
private val executeImplSymbol = symbols.executeImpl
private val executeImplProducerClassSymbol = symbols.functions[0]
private val executeImplProducerInvoke = executeImplProducerClassSymbol.owner.simpleFunctions()
private val executeImplProducerClass = symbols.functionN(0).owner
private val executeImplProducerInvoke = executeImplProducerClass.simpleFunctions()
.single { it.name == OperatorNameConventions.INVOKE }
private val reinterpret = symbols.reinterpret
@@ -1,30 +1,13 @@
package org.jetbrains.kotlin.backend.konan.serialization
import org.jetbrains.kotlin.backend.common.serialization.DescriptorReferenceDeserializer
import org.jetbrains.kotlin.backend.common.serialization.DescriptorUniqIdAware
import org.jetbrains.kotlin.backend.common.serialization.UniqId
import org.jetbrains.kotlin.backend.common.serialization.UniqIdKey
import org.jetbrains.kotlin.backend.common.serialization.*
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
// This is all information needed to find a descriptor in the
// tree of deserialized descriptors. Think of it as base + offset.
// packageFqName + classFqName + index allow to localize some deserialized descriptor.
// Then the rest of the fields allow to find the needed descriptor relative to the one with index.
class KonanDescriptorReferenceDeserializer(
currentModule: ModuleDescriptor,
resolvedForwardDeclarations: MutableMap<UniqIdKey, UniqIdKey>)
: DescriptorReferenceDeserializer(currentModule, resolvedForwardDeclarations),
DescriptorUniqIdAware by KonanDescriptorUniqIdAware{
// TODO: these are dummies. Eliminate them.
override fun resolveSpecialDescriptor(fqn: FqName): DeclarationDescriptor = currentModule
override fun checkIfSpecialDescriptorId(id: Long): Boolean = false
override fun getDescriptorIdOrNull(descriptor: DeclarationDescriptor): Long? = null
}
mangler: KotlinMangler,
builtIns: IrBuiltIns,
resolvedForwardDeclarations: MutableMap<UniqIdKey, UniqIdKey>
): DescriptorReferenceDeserializer(currentModule, mangler, builtIns, resolvedForwardDeclarations),
DescriptorUniqIdAware by KonanDescriptorUniqIdAware
@@ -17,10 +17,7 @@
package org.jetbrains.kotlin.backend.konan.serialization
import org.jetbrains.kotlin.backend.common.LoggingContext
import org.jetbrains.kotlin.backend.common.serialization.DescriptorUniqIdAware
import org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker
import org.jetbrains.kotlin.backend.common.serialization.UniqId
import org.jetbrains.kotlin.backend.common.serialization.UniqIdKey
import org.jetbrains.kotlin.backend.common.serialization.*
import org.jetbrains.kotlin.backend.konan.descriptors.konanLibrary
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.ir.declarations.IrFile
@@ -39,7 +36,7 @@ class KonanIrLinker(
DescriptorUniqIdAware by KonanDescriptorUniqIdAware {
override val descriptorReferenceDeserializer =
KonanDescriptorReferenceDeserializer(currentModule, resolvedForwardDeclarations)
KonanDescriptorReferenceDeserializer(currentModule, KonanDeclarationTable(builtIns, DescriptorTable()), builtIns, resolvedForwardDeclarations)
override fun reader(moduleDescriptor: ModuleDescriptor, uniqId: UniqId) =
moduleDescriptor.konanLibrary!!.irDeclaration(uniqId.index, uniqId.isLocal)
@@ -1,18 +1,20 @@
package org.jetbrains.kotlin.serialization.konan.impl
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.functions.functionInterfacePackageFragmentProvider
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.contracts.ContractDeserializerImpl
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.NotFoundClasses
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
import org.jetbrains.kotlin.descriptors.PackageFragmentProviderImpl
import org.jetbrains.kotlin.descriptors.impl.CompositePackageFragmentProvider
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.descriptors.konan.DeserializedKonanModuleOrigin
import org.jetbrains.kotlin.descriptors.konan.KonanModuleDescriptorFactory
import org.jetbrains.kotlin.descriptors.konan.isKonanStdlib
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.konan.library.KonanLibrary
import org.jetbrains.kotlin.konan.library.impl.KonanLibraryImpl
import org.jetbrains.kotlin.konan.library.resolver.PackageAccessedHandler
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.CompilerDeserializationConfiguration
@@ -68,7 +70,14 @@ internal class KonanDeserializedModuleDescriptorFactoryImpl(
moduleDescriptor,
deserializationConfiguration)
moduleDescriptor.initialize(provider)
if (!moduleDescriptor.isKonanStdlib())
moduleDescriptor.initialize(provider)
else {
// [K][Suspend]FunctionN belong to stdlib.
val packagePartProviders = mutableListOf(provider)
packagePartProviders += functionInterfacePackageFragmentProvider(storageManager, moduleDescriptor)
moduleDescriptor.initialize(CompositePackageFragmentProvider(packagePartProviders))
}
return moduleDescriptor
}
@@ -1,98 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package kotlin
public interface Function0<out R> : Function<R> {
operator fun invoke(): R
}
public interface Function1<in P1, out R> : Function<R> {
operator fun invoke(p1: P1): R
}
public interface Function2<in P1, in P2, out R> : Function<R> {
operator fun invoke(p1: P1, p2: P2): R
}
public interface Function3<in P1, in P2, in P3, out R> : Function<R> {
operator fun invoke(p1: P1, p2: P2, p3: P3): R
}
public interface Function4<in P1, in P2, in P3, in P4, out R> : Function<R> {
operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4): R
}
public interface Function5<in P1, in P2, in P3, in P4, in P5, out R> : Function<R> {
operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5): R
}
public interface Function6<in P1, in P2, in P3, in P4, in P5, in P6, out R> : Function<R> {
operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6): R
}
public interface Function7<in P1, in P2, in P3, in P4, in P5, in P6, in P7, out R> : Function<R> {
operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7): R
}
public interface Function8<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, out R> : Function<R> {
operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8): R
}
public interface Function9<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, out R> : Function<R> {
operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9): R
}
public interface Function10<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, out R> : Function<R> {
operator fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10): R
}
public interface Function11<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, out R> : Function<R> {
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
}
public interface Function12<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, out R> : Function<R> {
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
}
public interface Function13<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, out R> : Function<R> {
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
}
public interface Function14<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, out R> : Function<R> {
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
}
public interface Function15<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, out R> : Function<R> {
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
}
public interface Function16<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, out R> : Function<R> {
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
}
public interface Function17<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, out R> : Function<R> {
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
}
public interface Function18<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, out R> : Function<R> {
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
}
public interface Function19<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, out R> : Function<R> {
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
}
public interface Function20<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, out R> : Function<R> {
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
}
public interface Function21<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, in P21, out R> : Function<R> {
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
}
public interface Function22<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, in P21, in P22, out R> : Function<R> {
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
}
@@ -1,98 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package kotlin.coroutines
public interface SuspendFunction0<out R> : SuspendFunction<R> {
operator suspend fun invoke(): R
}
public interface SuspendFunction1<in P1, out R> : SuspendFunction<R> {
operator suspend fun invoke(p1: P1): R
}
public interface SuspendFunction2<in P1, in P2, out R> : SuspendFunction<R> {
operator suspend fun invoke(p1: P1, p2: P2): R
}
public interface SuspendFunction3<in P1, in P2, in P3, out R> : SuspendFunction<R> {
operator suspend fun invoke(p1: P1, p2: P2, p3: P3): R
}
public interface SuspendFunction4<in P1, in P2, in P3, in P4, out R> : SuspendFunction<R> {
operator suspend fun invoke(p1: P1, p2: P2, p3: P3, p4: P4): R
}
public interface SuspendFunction5<in P1, in P2, in P3, in P4, in P5, out R> : SuspendFunction<R> {
operator suspend fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5): R
}
public interface SuspendFunction6<in P1, in P2, in P3, in P4, in P5, in P6, out R> : SuspendFunction<R> {
operator suspend fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6): R
}
public interface SuspendFunction7<in P1, in P2, in P3, in P4, in P5, in P6, in P7, out R> : SuspendFunction<R> {
operator suspend fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7): R
}
public interface SuspendFunction8<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, out R> : SuspendFunction<R> {
operator suspend fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8): R
}
public interface SuspendFunction9<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, out R> : SuspendFunction<R> {
operator suspend fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9): R
}
public interface SuspendFunction10<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, out R> : SuspendFunction<R> {
operator suspend fun invoke(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, p10: P10): R
}
public interface SuspendFunction11<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, out R> : SuspendFunction<R> {
operator suspend 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
}
public interface SuspendFunction12<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, out R> : SuspendFunction<R> {
operator suspend 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
}
public interface SuspendFunction13<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, out R> : SuspendFunction<R> {
operator suspend 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
}
public interface SuspendFunction14<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, out R> : SuspendFunction<R> {
operator suspend 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
}
public interface SuspendFunction15<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, out R> : SuspendFunction<R> {
operator suspend 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
}
public interface SuspendFunction16<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, out R> : SuspendFunction<R> {
operator suspend 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
}
public interface SuspendFunction17<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, out R> : SuspendFunction<R> {
operator suspend 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
}
public interface SuspendFunction18<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, out R> : SuspendFunction<R> {
operator suspend 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
}
public interface SuspendFunction19<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, out R> : SuspendFunction<R> {
operator suspend 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
}
public interface SuspendFunction20<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, out R> : SuspendFunction<R> {
operator suspend 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
}
public interface SuspendFunction21<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, in P21, out R> : SuspendFunction<R> {
operator suspend 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
}
public interface SuspendFunction22<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, in P21, in P22, out R> : SuspendFunction<R> {
operator suspend 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
}
@@ -1,55 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
package kotlin.reflect
// (0..22).joinToString("\n") { i -> "interface KFunction$i<${(1..i).joinToString("") { j -> "in P$j, " }}out R> : Function$i<${(1..i).joinToString("") { j -> "P$j, " }}R>, KFunction<R>\n" }
interface KFunction0<out R> : Function0<R>, KFunction<R>
interface KFunction1<in P1, out R> : Function1<P1, R>, KFunction<R>
interface KFunction2<in P1, in P2, out R> : Function2<P1, P2, R>, KFunction<R>
interface KFunction3<in P1, in P2, in P3, out R> : Function3<P1, P2, P3, R>, KFunction<R>
interface KFunction4<in P1, in P2, in P3, in P4, out R> : Function4<P1, P2, P3, P4, R>, KFunction<R>
interface KFunction5<in P1, in P2, in P3, in P4, in P5, out R> : Function5<P1, P2, P3, P4, P5, R>, KFunction<R>
interface KFunction6<in P1, in P2, in P3, in P4, in P5, in P6, out R> : Function6<P1, P2, P3, P4, P5, P6, R>, KFunction<R>
interface KFunction7<in P1, in P2, in P3, in P4, in P5, in P6, in P7, out R> : Function7<P1, P2, P3, P4, P5, P6, P7, R>, KFunction<R>
interface KFunction8<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, out R> : Function8<P1, P2, P3, P4, P5, P6, P7, P8, R>, KFunction<R>
interface KFunction9<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, out R> : Function9<P1, P2, P3, P4, P5, P6, P7, P8, P9, R>, KFunction<R>
interface KFunction10<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, out R> : Function10<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, R>, KFunction<R>
interface KFunction11<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, out R> : Function11<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, R>, KFunction<R>
interface KFunction12<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, out R> : Function12<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, R>, KFunction<R>
interface KFunction13<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, out R> : Function13<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, R>, KFunction<R>
interface KFunction14<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, out R> : Function14<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, R>, KFunction<R>
interface KFunction15<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, out R> : Function15<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, R>, KFunction<R>
interface KFunction16<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, out R> : Function16<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, R>, KFunction<R>
interface KFunction17<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, out R> : Function17<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, R>, KFunction<R>
interface KFunction18<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, out R> : Function18<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, R>, KFunction<R>
interface KFunction19<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, out R> : Function19<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, R>, KFunction<R>
interface KFunction20<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, out R> : Function20<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, R>, KFunction<R>
interface KFunction21<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, in P21, out R> : Function21<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, R>, KFunction<R>
interface KFunction22<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, in P21, in P22, out R> : Function22<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22, R>, KFunction<R>
@@ -1,59 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
@file:Suppress("SUPERTYPE_IS_SUSPEND_FUNCTION_TYPE")
package kotlin.reflect
import kotlin.coroutines.*
// (0..22).joinToString("\n") { i -> "interface KSuspendFunction$i<${(1..i).joinToString("") { j -> "in P$j, " }}out R> : SuspendFunction$i<${(1..i).joinToString("") { j -> "P$j, " }}R>, KFunction<R>\n" }
interface KSuspendFunction0<out R> : SuspendFunction0<R>, KFunction<R>
interface KSuspendFunction1<in P1, out R> : SuspendFunction1<P1, R>, KFunction<R>
interface KSuspendFunction2<in P1, in P2, out R> : SuspendFunction2<P1, P2, R>, KFunction<R>
interface KSuspendFunction3<in P1, in P2, in P3, out R> : SuspendFunction3<P1, P2, P3, R>, KFunction<R>
interface KSuspendFunction4<in P1, in P2, in P3, in P4, out R> : SuspendFunction4<P1, P2, P3, P4, R>, KFunction<R>
interface KSuspendFunction5<in P1, in P2, in P3, in P4, in P5, out R> : SuspendFunction5<P1, P2, P3, P4, P5, R>, KFunction<R>
interface KSuspendFunction6<in P1, in P2, in P3, in P4, in P5, in P6, out R> : SuspendFunction6<P1, P2, P3, P4, P5, P6, R>, KFunction<R>
interface KSuspendFunction7<in P1, in P2, in P3, in P4, in P5, in P6, in P7, out R> : SuspendFunction7<P1, P2, P3, P4, P5, P6, P7, R>, KFunction<R>
interface KSuspendFunction8<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, out R> : SuspendFunction8<P1, P2, P3, P4, P5, P6, P7, P8, R>, KFunction<R>
interface KSuspendFunction9<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, out R> : SuspendFunction9<P1, P2, P3, P4, P5, P6, P7, P8, P9, R>, KFunction<R>
interface KSuspendFunction10<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, out R> : SuspendFunction10<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, R>, KFunction<R>
interface KSuspendFunction11<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, out R> : SuspendFunction11<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, R>, KFunction<R>
interface KSuspendFunction12<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, out R> : SuspendFunction12<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, R>, KFunction<R>
interface KSuspendFunction13<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, out R> : SuspendFunction13<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, R>, KFunction<R>
interface KSuspendFunction14<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, out R> : SuspendFunction14<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, R>, KFunction<R>
interface KSuspendFunction15<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, out R> : SuspendFunction15<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, R>, KFunction<R>
interface KSuspendFunction16<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, out R> : SuspendFunction16<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, R>, KFunction<R>
interface KSuspendFunction17<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, out R> : SuspendFunction17<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, R>, KFunction<R>
interface KSuspendFunction18<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, out R> : SuspendFunction18<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, R>, KFunction<R>
interface KSuspendFunction19<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, out R> : SuspendFunction19<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, R>, KFunction<R>
interface KSuspendFunction20<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, out R> : SuspendFunction20<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, R>, KFunction<R>
interface KSuspendFunction21<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, in P21, out R> : SuspendFunction21<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, R>, KFunction<R>
// Comment for now. The reason: https://github.com/JetBrains/kotlin/blob/ad1b795a69925e6ee8c79cbbd05cce8cd27a6704/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.kt#L555
//interface KSuspendFunction22<in P1, in P2, in P3, in P4, in P5, in P6, in P7, in P8, in P9, in P10, in P11, in P12, in P13, in P14, in P15, in P16, in P17, in P18, in P19, in P20, in P21, in P22, out R> : SuspendFunction22<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22, R>, KFunction<R>