diff --git a/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt b/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt index 13fd08daf7a..1ec43707df3 100644 --- a/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt +++ b/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt @@ -194,6 +194,7 @@ class K2Native : CLICompiler() { put(EXPORTED_LIBRARIES, selectExportedLibraries(configuration, arguments, outputKind)) put(FRAMEWORK_IMPORT_HEADERS, arguments.frameworkImportHeaders.toNonNullList()) + arguments.emitLazyObjCHeader?.let { put(EMIT_LAZY_OBJC_HEADER_FILE, it) } put(BITCODE_EMBEDDING_MODE, selectBitcodeEmbeddingMode(this, arguments, outputKind)) put(DEBUG_INFO_VERSION, arguments.debugInfoFormatVersion.toInt()) diff --git a/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt b/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt index 03231e4783c..5297afe7738 100644 --- a/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt +++ b/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt @@ -108,6 +108,9 @@ class K2NativeCompilerArguments : CommonCompilerArguments() { @Argument(value = EMBED_BITCODE_MARKER_FLAG, description = "Embed placeholder LLVM IR data as a marker") var embedBitcodeMarker: Boolean = false + @Argument(value = "-Xemit-lazy-objc-header", description = "") + var emitLazyObjCHeader: String? = null + @Argument(value = "-Xenable", deprecatedName = "--enable", valueDescription = "", description = "Enable backend phase") var enablePhases: Array? = null diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanCompilerFrontendServices.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanCompilerFrontendServices.kt new file mode 100644 index 00000000000..8e481a1c04e --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanCompilerFrontendServices.kt @@ -0,0 +1,42 @@ +/* + * 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.analyzer.ModuleInfo +import org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportLazy +import org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportLazyImpl +import org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportWarningCollector +import org.jetbrains.kotlin.backend.konan.objcexport.dumpObjCHeader +import org.jetbrains.kotlin.config.CompilerConfiguration +import org.jetbrains.kotlin.container.* +import org.jetbrains.kotlin.psi.KtFile + +internal fun StorageComponentContainer.initContainer(config: KonanConfig) { + if (config.configuration.get(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE) != null) { + this.useImpl() + this.useInstance(ObjCExportWarningCollector.SILENT) + + useInstance(object : ObjCExportLazy.Configuration { + override val frameworkName: String + get() = config.moduleId + + override fun isIncluded(moduleInfo: ModuleInfo): Boolean = true + + override fun getCompilerModuleName(moduleInfo: ModuleInfo): String { + TODO() + } + + override val objcGenerics: Boolean + get() = config.configuration.getBoolean(KonanConfigKeys.OBJC_GENERICS) + }) + } +} + +internal fun ComponentProvider.postprocessComponents(configuration: CompilerConfiguration, files: Collection) { + configuration.get(KonanConfigKeys.EMIT_LAZY_OBJC_HEADER_FILE)?.let { + this.get().dumpObjCHeader(files, it) + } +} \ No newline at end of file diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfigurationKeys.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfigurationKeys.kt index f00f8c372a2..23609643421 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfigurationKeys.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfigurationKeys.kt @@ -22,6 +22,8 @@ class KonanConfigKeys { = CompilerConfigurationKey.create("disable backend phases") val BITCODE_EMBEDDING_MODE: CompilerConfigurationKey = CompilerConfigurationKey.create("bitcode embedding mode") + val EMIT_LAZY_OBJC_HEADER_FILE: CompilerConfigurationKey = + CompilerConfigurationKey.create("output file to emit lazy Obj-C header") val ENABLE_ASSERTIONS: CompilerConfigurationKey = CompilerConfigurationKey.create("enable runtime assertions in generated code") val ENABLED_PHASES: CompilerConfigurationKey> diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/TopDownAnalyzerFacadeForKonan.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/TopDownAnalyzerFacadeForKonan.kt index 3575fe55797..e27a892daa4 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/TopDownAnalyzerFacadeForKonan.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/TopDownAnalyzerFacadeForKonan.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.analyzer.AnalysisResult import org.jetbrains.kotlin.builtins.KotlinBuiltIns 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 @@ -69,11 +70,15 @@ internal object TopDownAnalyzerFacadeForKonan { frontendPhase in context.phaseConfig.verbose } ?.forEach(::println) - val analyzerForKonan = createTopDownAnalyzerForKonan( + val analyzerForKonan = createTopDownAnalyzerProviderForKonan( moduleContext, trace, FileBasedDeclarationProviderFactory(moduleContext.storageManager, files), context.config.configuration.get(CommonConfigurationKeys.LANGUAGE_VERSION_SETTINGS)!! - ) + ) { + initContainer(context.config) + }.apply { + postprocessComponents(context.config.configuration, files) + }.get() analyzerForKonan.analyzeDeclarations(TopDownAnalysisMode.TopLevelDeclarations, files) return AnalysisResult.success(trace.bindingContext, moduleContext.module) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/injection.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/injection.kt index 6a6e8eb8dee..a6fabe519a2 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/injection.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/injection.kt @@ -6,9 +6,7 @@ package org.jetbrains.kotlin.backend.konan import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.config.TargetPlatformVersion -import org.jetbrains.kotlin.container.get -import org.jetbrains.kotlin.container.useImpl -import org.jetbrains.kotlin.container.useInstance +import org.jetbrains.kotlin.container.* import org.jetbrains.kotlin.context.ModuleContext import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl import org.jetbrains.kotlin.frontend.di.configureModule @@ -18,13 +16,14 @@ import org.jetbrains.kotlin.resolve.lazy.KotlinCodeAnalyzer import org.jetbrains.kotlin.resolve.lazy.ResolveSession import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory -fun createTopDownAnalyzerForKonan( +fun createTopDownAnalyzerProviderForKonan( moduleContext: ModuleContext, bindingTrace: BindingTrace, declarationProviderFactory: DeclarationProviderFactory, - languageVersionSettings: LanguageVersionSettings -): LazyTopDownAnalyzer { - val storageComponentContainer = createContainer("TopDownAnalyzerForKonan", KonanPlatform) { + languageVersionSettings: LanguageVersionSettings, + initContainer: StorageComponentContainer.() -> Unit +): ComponentProvider { + return createContainer("TopDownAnalyzerForKonan", KonanPlatform) { configureModule(moduleContext, KonanPlatform, TargetPlatformVersion.NoVersion, bindingTrace) useInstance(declarationProviderFactory) @@ -35,8 +34,9 @@ fun createTopDownAnalyzerForKonan( useInstance(languageVersionSettings) useImpl() useImpl() + + initContainer() }.apply { get().initialize(get().packageFragmentProvider) } - return storageComponentContainer.get() } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt index 8733072dcca..dfc374712ad 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt @@ -19,6 +19,7 @@ import org.jetbrains.kotlin.resolve.constants.ArrayValue import org.jetbrains.kotlin.resolve.constants.KClassValue import org.jetbrains.kotlin.resolve.descriptorUtil.* import org.jetbrains.kotlin.resolve.scopes.MemberScope +import org.jetbrains.kotlin.types.ErrorUtils import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.Variance @@ -190,7 +191,7 @@ internal class ObjCExportTranslatorImpl( private fun referenceClass(descriptor: ClassDescriptor): ObjCExportNamer.ClassOrProtocolName { fun forwardDeclarationObjcClassName(objcGenerics: Boolean, descriptor: ClassDescriptor, namer:ObjCExportNamer): String { - val className = namer.getClassOrProtocolName(descriptor) + val className = translateClassOrInterfaceName(descriptor) val builder = StringBuilder(className.objCName) if (objcGenerics) formatGenerics(builder, descriptor.typeConstructor.parameters.map { typeParameterDescriptor -> @@ -221,13 +222,18 @@ internal class ObjCExportTranslatorImpl( private fun translateClassOrInterfaceName(descriptor: ClassDescriptor): ObjCExportNamer.ClassOrProtocolName { assert(mapper.shouldBeExposed(descriptor)) + if (ErrorUtils.isError(descriptor)) { + return ObjCExportNamer.ClassOrProtocolName("ERROR", "ERROR") + } return namer.getClassOrProtocolName(descriptor) } override fun translateInterface(descriptor: ClassDescriptor): ObjCProtocol { - require(mapper.shouldBeExposed(descriptor)) require(descriptor.isInterface) + if (!mapper.shouldBeExposed(descriptor)) { + return translateUnexposedInterfaceAsUnavailableStub(descriptor) + } val name = translateClassOrInterfaceName(descriptor) val members: List> = buildMembers { translateInterfaceMembers(descriptor) } @@ -276,8 +282,10 @@ internal class ObjCExportTranslatorImpl( } override fun translateClass(descriptor: ClassDescriptor): ObjCInterface { - require(mapper.shouldBeExposed(descriptor)) require(!descriptor.isInterface) + if (!mapper.shouldBeExposed(descriptor)) { + return translateUnexposedClassAsUnavailableStub(descriptor) + } val genericExportScope = genericExportScope(descriptor) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportLazy.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportLazy.kt new file mode 100644 index 00000000000..0473f2e25db --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportLazy.kt @@ -0,0 +1,408 @@ +/* + * 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.objcexport + +import org.jetbrains.kotlin.analyzer.ModuleInfo +import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.annotations.Annotations +import org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl +import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl +import org.jetbrains.kotlin.descriptors.konan.isKonanStdlib +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.hasExpectModifier +import org.jetbrains.kotlin.psi.psiUtil.modalityModifier +import org.jetbrains.kotlin.psi.psiUtil.visibilityModifierTypeOrDefault +import org.jetbrains.kotlin.resolve.BindingTrace +import org.jetbrains.kotlin.resolve.BindingTraceContext +import org.jetbrains.kotlin.resolve.DescriptorResolver +import org.jetbrains.kotlin.resolve.TypeResolver +import org.jetbrains.kotlin.resolve.descriptorUtil.module +import org.jetbrains.kotlin.resolve.lazy.FileScopeProvider +import org.jetbrains.kotlin.resolve.lazy.ResolveSession +import org.jetbrains.kotlin.resolve.scopes.LexicalScope +import org.jetbrains.kotlin.resolve.scopes.LexicalScopeKind +import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope +import org.jetbrains.kotlin.resolve.scopes.LocalRedeclarationChecker +import org.jetbrains.kotlin.resolve.source.PsiSourceFile +import org.jetbrains.kotlin.types.ErrorUtils + +interface ObjCExportLazy { + interface Configuration { + val frameworkName: String + fun isIncluded(moduleInfo: ModuleInfo): Boolean + fun getCompilerModuleName(moduleInfo: ModuleInfo): String + val objcGenerics: Boolean + } + + fun generateBase(): List> + + fun translate(file: KtFile): List> +} + +fun createObjCExportLazy( + configuration: ObjCExportLazy.Configuration, + warningCollector: ObjCExportWarningCollector, + resolveSession: ResolveSession, + typeResolver: TypeResolver, + descriptorResolver: DescriptorResolver, + fileScopeProvider: FileScopeProvider, + builtIns: KotlinBuiltIns +): ObjCExportLazy = ObjCExportLazyImpl( + configuration, + warningCollector, + resolveSession, + typeResolver, + descriptorResolver, + fileScopeProvider, + builtIns +) + +internal class ObjCExportLazyImpl( + private val configuration: ObjCExportLazy.Configuration, + warningCollector: ObjCExportWarningCollector, + private val resolveSession: ResolveSession, + private val typeResolver: TypeResolver, + private val descriptorResolver: DescriptorResolver, + private val fileScopeProvider: FileScopeProvider, + builtIns: KotlinBuiltIns +) : ObjCExportLazy { + + private val namerConfiguration = createNamerConfiguration(configuration) + + private val nameTranslator: ObjCExportNameTranslator = ObjCExportNameTranslatorImpl(namerConfiguration) + + private val mapper = ObjCExportMapper(local = true) + + private val namer = ObjCExportNamerImpl(namerConfiguration, builtIns, mapper, local = true) + + private val translator: ObjCExportTranslator = ObjCExportTranslatorImpl( + null, + mapper, + namer, + warningCollector, + objcGenerics = configuration.objcGenerics + ) + + override fun generateBase() = translator.generateBaseDeclarations() + + override fun translate(file: KtFile): List> = + translateClasses(file) + translateTopLevels(file) + + private fun translateClasses(container: KtDeclarationContainer): List> { + val result = mutableListOf>() + container.declarations.forEach { declaration -> + // Supposed to be equivalent to ObjCExportMapper.shouldBeVisible. + if (declaration is KtClassOrObject && declaration.isPublic && declaration !is KtEnumEntry + && !declaration.hasExpectModifier()) { + + if (!declaration.isAnnotation() && !declaration.hasModifier(KtTokens.INLINE_KEYWORD)) { + result += translateClass(declaration) + } + + declaration.body?.let { + result += translateClasses(it) + } + } + } + return result + } + + private fun translateClass(ktClassOrObject: KtClassOrObject): ObjCClass<*> { + val name = nameTranslator.getClassOrProtocolName(ktClassOrObject) + + // Note: some attributes may be missing (e.g. "unavailable" for unexposed classes). + + return if (ktClassOrObject.isInterface) { + object : LazyObjCProtocol(name) { + override val descriptor: ClassDescriptor by lazy { resolve(ktClassOrObject) } + + override fun computeRealStub(): ObjCProtocol = translator.translateInterface(descriptor) + } + } else { + val isFinal = ktClassOrObject.modalityModifier() == null || + ktClassOrObject.hasModifier(KtTokens.FINAL_KEYWORD) + + val attributes = if (isFinal) { + listOf(OBJC_SUBCLASSING_RESTRICTED) + } else { + emptyList() + } + + object : LazyObjCInterface( + name, + generics = if (configuration.objcGenerics) TODO() else emptyList(), + categoryName = null, + attributes = attributes + ) { + override val descriptor: ClassDescriptor by lazy { resolve(ktClassOrObject) } + + override fun computeRealStub(): ObjCInterface = translator.translateClass(descriptor) + } + } + } + + private fun translateTopLevels(file: KtFile): List { + val extensions = + mutableMapOf>() + + val topLevel = mutableListOf() + + file.children.filterIsInstance().forEach { + // Supposed to be similar to ObjCExportMapper.shouldBeVisible. + if ((it is KtFunction || it is KtProperty) && it.isPublic && !it.isSuspend && !it.hasExpectModifier()) { + val classDescriptor = getClassIfExtension(it) + if (classDescriptor != null) { + extensions.getOrPut(classDescriptor, { mutableListOf() }) += it + } else { + topLevel += it + } + } + } + + val result = mutableListOf() + + extensions.mapTo(result) { (classDescriptor, declarations) -> + translateExtensions(file, classDescriptor, declarations) + } + + if (topLevel.isNotEmpty()) result += translateFileClass(file, topLevel) + + return result + } + + private fun translateFileClass(file: KtFile, declarations: List): ObjCInterface { + val name = nameTranslator.getFileClassName(file) + + return object : LazyObjCInterface( + name, + generics = emptyList(), + categoryName = null, + attributes = listOf(OBJC_SUBCLASSING_RESTRICTED) + ) { + override val descriptor: ClassDescriptor? + get() = null + + override fun computeRealStub(): ObjCInterface = translator.translateFile( + PsiSourceFile(file), + declarations.mapNotNull { declaration -> + resolve(declaration).takeIf { mapper.shouldBeExposed(it) } + } + ) + } + } + + private fun translateExtensions( + file: KtFile, + classDescriptor: ClassDescriptor, + declarations: List + ): ObjCInterface { + // TODO: consider using file-based categories in compiler too. + + val name = if (ErrorUtils.isError(classDescriptor)) { + ObjCExportNamer.ClassOrProtocolName("ERROR", "ERROR") + } else { + namer.getClassOrProtocolName(classDescriptor) + } + + return object : LazyObjCInterface( + name.objCName, + generics = emptyList(), + categoryName = nameTranslator.getCategoryName(file), + attributes = emptyList() + ) { + override val descriptor: ClassDescriptor? + get() = null + + override fun computeRealStub(): ObjCInterface = translator.translateExtensions( + classDescriptor, + declarations.mapNotNull { declaration -> + resolve(declaration).takeIf { mapper.shouldBeExposed(it) } + } + ) + } + } + + private fun resolveDeclaration(ktDeclaration: KtDeclaration): DeclarationDescriptor = + resolveSession.resolveToDescriptor(ktDeclaration) + + private fun resolve(ktClassOrObject: KtClassOrObject) = + resolveDeclaration(ktClassOrObject) as ClassDescriptor + + private fun resolve(ktCallableDeclaration: KtCallableDeclaration) = + resolveDeclaration(ktCallableDeclaration) as CallableMemberDescriptor + + private fun getClassIfExtension(topLevelDeclaration: KtCallableDeclaration): ClassDescriptor? { + val receiverType = topLevelDeclaration.receiverTypeReference ?: return null + val fileScope = fileScopeProvider.getFileResolutionScope(topLevelDeclaration.containingKtFile) + + val trace = BindingTraceContext() // TODO: revise. + + val kotlinReceiverType = typeResolver.resolveType( + createHeaderScope(topLevelDeclaration, fileScope, trace), + receiverType, + trace, + checkBounds = false + ) + + return translator.getClassIfExtension(kotlinReceiverType) + } + + private fun createHeaderScope( + declaration: KtCallableDeclaration, + parent: LexicalScope, + trace: BindingTrace + ): LexicalScope { + if (declaration.typeParameters.isEmpty()) return parent + + val fakeName = Name.special("") + val sourceElement = SourceElement.NO_SOURCE + + val descriptor: CallableMemberDescriptor + val scopeKind: LexicalScopeKind + + when (declaration) { + is KtFunction -> { + descriptor = SimpleFunctionDescriptorImpl.create( + parent.ownerDescriptor, + Annotations.EMPTY, + fakeName, + CallableMemberDescriptor.Kind.DECLARATION, + sourceElement + ) + scopeKind = LexicalScopeKind.FUNCTION_HEADER + } + is KtProperty -> { + descriptor = PropertyDescriptorImpl.create( + parent.ownerDescriptor, + Annotations.EMPTY, + Modality.FINAL, + Visibilities.PUBLIC, + declaration.isVar, + fakeName, + CallableMemberDescriptor.Kind.DECLARATION, + sourceElement, + false, + false, + false, + false, + false, + false + ) + scopeKind = LexicalScopeKind.PROPERTY_HEADER + } + else -> TODO("${declaration::class}") + } + + val result = LexicalWritableScope( + parent, + descriptor, + false, + LocalRedeclarationChecker.DO_NOTHING, + scopeKind + ) + + val typeParameters = descriptorResolver.resolveTypeParametersForDescriptor( + descriptor, + result, + result, + declaration.typeParameters, + trace + ) + + descriptorResolver.resolveGenericBounds(declaration, descriptor, result, typeParameters, trace) + + return result + } +} + +private abstract class LazyObjCInterface : ObjCInterface { + + constructor( + name: ObjCExportNamer.ClassOrProtocolName, + generics: List, + categoryName: String?, + attributes: List + ) : super(name.objCName, generics, categoryName, attributes + name.toNameAttributes()) + + constructor( + name: String, + generics: List, + categoryName: String, + attributes: List + ) : super(name, generics, categoryName, attributes) + + protected abstract fun computeRealStub(): ObjCInterface + + private val realStub by lazy { computeRealStub() } + + override val members: List> + get() = realStub.members + + override val superProtocols: List + get() = realStub.superProtocols + + override val superClass: String? + get() = realStub.superClass + + override val superClassGenerics: List + get() = realStub.superClassGenerics +} + +private abstract class LazyObjCProtocol( + name: ObjCExportNamer.ClassOrProtocolName +) : ObjCProtocol(name.objCName, name.toNameAttributes()) { + + protected abstract fun computeRealStub(): ObjCProtocol + + private val realStub by lazy { computeRealStub() } + + override val members: List> + get() = realStub.members + + override val superProtocols: List + get() = realStub.superProtocols +} + +private fun createNamerConfiguration(configuration: ObjCExportLazy.Configuration): ObjCExportNamer.Configuration { + return object : ObjCExportNamer.Configuration { + override val topLevelNamePrefix = abbreviate(configuration.frameworkName) + + override fun getAdditionalPrefix(module: ModuleDescriptor): String? { + if (module.isStdlib()) return "Kotlin" + + // Note: incorrect for compiler since it doesn't store ModuleInfo to ModuleDescriptor. + val moduleInfo = module.getCapability(ModuleInfo.Capability) ?: return null + if (configuration.isIncluded(moduleInfo)) return null + return abbreviate(configuration.getCompilerModuleName(moduleInfo)) + } + + override val objcGenerics = configuration.objcGenerics + } +} + +// TODO: find proper solution. +private fun ModuleDescriptor.isStdlib(): Boolean = + this.builtIns == this || this.isCommonStdlib() || this.isKonanStdlib() + +private val kotlinSequenceClassId = ClassId.topLevel(FqName("kotlin.sequences.Sequence")) + +private fun ModuleDescriptor.isCommonStdlib() = + this.findClassAcrossModuleDependencies(kotlinSequenceClassId)?.module == this + + +private val KtModifierListOwner.isPublic: Boolean + get() = this.visibilityModifierTypeOrDefault() == KtTokens.PUBLIC_KEYWORD + +private val KtCallableDeclaration.isSuspend: Boolean + get() = this.hasModifier(KtTokens.SUSPEND_KEYWORD) + +internal val KtPureClassOrObject.isInterface: Boolean + get() = this is KtClass && this.isInterface() diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportLazyUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportLazyUtils.kt new file mode 100644 index 00000000000..bdea63ee33e --- /dev/null +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportLazyUtils.kt @@ -0,0 +1,16 @@ +/* + * 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.objcexport + +import org.jetbrains.kotlin.konan.file.File +import org.jetbrains.kotlin.psi.KtFile + +internal fun ObjCExportLazy.dumpObjCHeader(files: Collection, outputFile: String) { + val lines = (this.generateBase() + files.flatMap { this.translate(it) }) + .flatMap { StubRenderer.render(it) + listOf("") } + + File(outputFile).writeLines(lines) +} \ No newline at end of file diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportMapper.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportMapper.kt index a9c11b4ebc4..9d588e57430 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportMapper.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportMapper.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.typeUtil.isNothing import org.jetbrains.kotlin.types.typeUtil.isUnit -internal class ObjCExportMapper { +internal class ObjCExportMapper(private val local: Boolean = false) { companion object { val maxFunctionTypeParameterCount get() = KONAN_FUNCTION_INTERFACES_MAX_PARAMETERS } @@ -36,8 +36,12 @@ internal class ObjCExportMapper { private val methodBridgeCache = mutableMapOf() - fun bridgeMethod(descriptor: FunctionDescriptor): MethodBridge = methodBridgeCache.getOrPut(descriptor) { + fun bridgeMethod(descriptor: FunctionDescriptor): MethodBridge = if (local) { bridgeMethodImpl(descriptor) + } else { + methodBridgeCache.getOrPut(descriptor) { + bridgeMethodImpl(descriptor) + } } } @@ -63,12 +67,14 @@ internal fun ObjCExportMapper.getClassIfCategory(extensionReceiverType: KotlinTy } } +// Note: partially duplicated in ObjCExportLazyImpl.translateTopLevels. internal fun ObjCExportMapper.shouldBeExposed(descriptor: CallableMemberDescriptor): Boolean = descriptor.isEffectivelyPublicApi && !descriptor.isSuspend && !descriptor.isExpect internal fun ObjCExportMapper.shouldBeExposed(descriptor: ClassDescriptor): Boolean = shouldBeVisible(descriptor) && !isSpecialMapped(descriptor) && !descriptor.defaultType.isObjCObjectType() +// Note: the logic is duplicated in ObjCExportLazyImpl.translateClasses. internal fun ObjCExportMapper.shouldBeVisible(descriptor: ClassDescriptor): Boolean = descriptor.isEffectivelyPublicApi && when (descriptor.kind) { ClassKind.CLASS, ClassKind.INTERFACE, ClassKind.ENUM_CLASS, ClassKind.OBJECT -> true diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportNamer.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportNamer.kt index a4a9705c6b4..5fcdd0af2cf 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportNamer.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportNamer.kt @@ -15,11 +15,22 @@ import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType import org.jetbrains.kotlin.resolve.descriptorUtil.isSubclassOf import org.jetbrains.kotlin.resolve.descriptorUtil.module import org.jetbrains.kotlin.resolve.source.PsiSourceFile +internal interface ObjCExportNameTranslator { + fun getFileClassName(file: KtFile): ObjCExportNamer.ClassOrProtocolName + + fun getCategoryName(file: KtFile): String + + fun getClassOrProtocolName( + ktClassOrObject: KtClassOrObject + ): ObjCExportNamer.ClassOrProtocolName +} + interface ObjCExportNamer { data class ClassOrProtocolName(val swiftName: String, val objCName: String, val binaryName: String = objCName) @@ -57,11 +68,92 @@ fun createNamer( ): ObjCExportNamer = ObjCExportNamerImpl( (exportedDependencies + moduleDescriptor).toSet(), moduleDescriptor.builtIns, - ObjCExportMapper(), + ObjCExportMapper(local = true), topLevelNamePrefix, local = true ) +// Note: this class duplicates some of ObjCExportNamerImpl logic, +// but operates on different representation. +internal open class ObjCExportNameTranslatorImpl( + configuration: ObjCExportNamer.Configuration +) : ObjCExportNameTranslator { + + private val helper = ObjCExportNamingHelper(configuration.topLevelNamePrefix) + + override fun getFileClassName(file: KtFile): ObjCExportNamer.ClassOrProtocolName = + helper.getFileClassName(file) + + override fun getCategoryName(file: KtFile): String = + helper.translateFileName(file) + + override fun getClassOrProtocolName( + ktClassOrObject: KtClassOrObject + ): ObjCExportNamer.ClassOrProtocolName = helper.swiftClassNameToObjC( + getClassOrProtocolSwiftName(ktClassOrObject) + ) + + private fun getClassOrProtocolSwiftName( + ktClassOrObject: KtClassOrObject + ): String = buildString { + val outerClass = ktClassOrObject.getStrictParentOfType() + if (outerClass != null) { + append(getClassOrProtocolSwiftName(outerClass)) + + val importAsMember = when { + // FIXME: generics. + + ktClassOrObject.isInterface || outerClass.isInterface -> { + // Swift doesn't support neither nested nor outer protocols. + false + } + + this.contains('.') -> { + // Swift doesn't support swift_name with deeply nested names. + // It seems to support "OriginalObjCName.SwiftName" though, + // but this doesn't seem neither documented nor reliable. + false + } + + else -> true + } + + if (importAsMember) { + append(".").append(ktClassOrObject.name!!) + } else { + append(ktClassOrObject.name!!.capitalize()) + } + } else { + append(ktClassOrObject.name) + } + } +} + +private class ObjCExportNamingHelper( + private val topLevelNamePrefix: String +) { + + fun translateFileName(fileName: String): String = PackagePartClassUtils.getFilePartShortName(fileName) + + fun translateFileName(file: KtFile): String = translateFileName(file.name) + + fun getFileClassName(fileName: String): ObjCExportNamer.ClassOrProtocolName { + val baseName = translateFileName(fileName) + return ObjCExportNamer.ClassOrProtocolName(swiftName = baseName, objCName = "$topLevelNamePrefix$baseName") + } + + fun swiftClassNameToObjC(swiftName: String): ObjCExportNamer.ClassOrProtocolName = + ObjCExportNamer.ClassOrProtocolName(swiftName, buildString { + append(topLevelNamePrefix) + swiftName.split('.').forEachIndexed { index, part -> + append(if (index == 0) part else part.capitalize()) + } + }) + + fun getFileClassName(file: KtFile): ObjCExportNamer.ClassOrProtocolName = + getFileClassName(file.name) +} + internal class ObjCExportNamerImpl( private val configuration: ObjCExportNamer.Configuration, builtIns: KotlinBuiltIns, @@ -98,6 +190,7 @@ internal class ObjCExportNamerImpl( private val objcGenerics get() = configuration.objcGenerics private val topLevelNamePrefix get() = configuration.topLevelNamePrefix + private val helper = ObjCExportNamingHelper(configuration.topLevelNamePrefix) private fun String.toSpecialStandardClassOrProtocolName() = ObjCExportNamer.ClassOrProtocolName( swiftName = "Kotlin$this", @@ -181,7 +274,7 @@ internal class ObjCExportNamerImpl( } override fun getFileClassName(file: SourceFile): ObjCExportNamer.ClassOrProtocolName { - val baseName by lazy { + val candidate by lazy { val fileName = when (file) { is PsiSourceFile -> { val psiFile = file.psiFile @@ -190,17 +283,15 @@ internal class ObjCExportNamerImpl( } else -> file.name ?: error("$file has no name") } - PackagePartClassUtils.getFilePartShortName(fileName) + helper.getFileClassName(fileName) } val objCName = objCClassNames.getOrPut(file) { - StringBuilder(topLevelNamePrefix).append(baseName) - .mangledBySuffixUnderscores() + StringBuilder(candidate.objCName).mangledBySuffixUnderscores() } val swiftName = swiftClassAndProtocolNames.getOrPut(file) { - StringBuilder(baseName) - .mangledBySuffixUnderscores() + StringBuilder(candidate.swiftName).mangledBySuffixUnderscores() } return ObjCExportNamer.ClassOrProtocolName(swiftName = swiftName, objCName = objCName) @@ -717,14 +808,16 @@ private fun ObjCExportMapper.canHaveSameName(first: PropertyDescriptor, second: internal val ModuleDescriptor.namePrefix: String get() { if (this.isKonanStdlib()) return "Kotlin" - // -> FooBar - val moduleName = this.name.asString() - .let { it.substring(1, it.lastIndex) } - .capitalize() - .replace('-', '_') + return abbreviate(this.name.asString().let { it.substring(1, it.lastIndex) }) +} - val uppers = moduleName.filterIndexed { index, character -> index == 0 || character.isUpperCase() } +internal fun abbreviate(name: String): String { + val normalizedName = name + .capitalize() + .replace('-', '_') + + val uppers = normalizedName.filterIndexed { index, character -> index == 0 || character.isUpperCase() } if (uppers.length >= 3) return uppers - return moduleName + return normalizedName } diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index be178fadba4..535c3cd87c9 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -3355,16 +3355,34 @@ if (isAppleTarget(project)) { task testValuesFramework(type: FrameworkTest) { frameworkName = 'Values' + + final String dir = "$testOutputFramework/$frameworkName" + final File lazyHeader = file("$dir/$target-lazy.h") + + doFirst { + final File expectedLazyHeader = file("framework/values/expectedLazy.h") + + if (expectedLazyHeader.readLines() != lazyHeader.readLines()) { + exec { + commandLine 'diff', '-u', expectedLazyHeader, lazyHeader + ignoreExitValue = true + } + throw new Error("$expectedLazyHeader and $lazyHeader files differ") + } + + } + konanArtifacts { framework(frameworkName, targets: [ target ]) { srcDir 'framework/values' - baseDir "$testOutputFramework/$frameworkName" + baseDir dir if (!useCustomDist) { dependsOn ":${target}CrossDistRuntime", ':commonDistRuntime', ':distCompiler' } extraOpts "-Xembed-bitcode-marker" + extraOpts "-Xemit-lazy-objc-header=$lazyHeader" } } swiftSources = ['framework/values/values.swift'] diff --git a/backend.native/tests/framework/values/expectedLazy.h b/backend.native/tests/framework/values/expectedLazy.h new file mode 100644 index 00000000000..1e94cb20c0c --- /dev/null +++ b/backend.native/tests/framework/values/expectedLazy.h @@ -0,0 +1,630 @@ +@interface KotlinBase : NSObject +- (instancetype)init __attribute__((unavailable)); ++ (instancetype)new __attribute__((unavailable)); ++ (void)initialize __attribute__((objc_requires_super)); +@end; + +@interface KotlinBase (KotlinBaseCopying) +@end; + +__attribute__((objc_runtime_name("KotlinMutableSet"))) +__attribute__((swift_name("KotlinMutableSet"))) +@interface ValuesMutableSet : NSMutableSet +@end; + +__attribute__((objc_runtime_name("KotlinMutableDictionary"))) +__attribute__((swift_name("KotlinMutableDictionary"))) +@interface ValuesMutableDictionary : NSMutableDictionary +@end; + +@interface NSError (NSErrorKotlinException) +@property (readonly) id _Nullable kotlinException; +@end; + +__attribute__((objc_runtime_name("KotlinNumber"))) +__attribute__((swift_name("KotlinNumber"))) +@interface ValuesNumber : NSNumber +- (instancetype)initWithChar:(char)value __attribute__((unavailable)); +- (instancetype)initWithUnsignedChar:(unsigned char)value __attribute__((unavailable)); +- (instancetype)initWithShort:(short)value __attribute__((unavailable)); +- (instancetype)initWithUnsignedShort:(unsigned short)value __attribute__((unavailable)); +- (instancetype)initWithInt:(int)value __attribute__((unavailable)); +- (instancetype)initWithUnsignedInt:(unsigned int)value __attribute__((unavailable)); +- (instancetype)initWithLong:(long)value __attribute__((unavailable)); +- (instancetype)initWithUnsignedLong:(unsigned long)value __attribute__((unavailable)); +- (instancetype)initWithLongLong:(long long)value __attribute__((unavailable)); +- (instancetype)initWithUnsignedLongLong:(unsigned long long)value __attribute__((unavailable)); +- (instancetype)initWithFloat:(float)value __attribute__((unavailable)); +- (instancetype)initWithDouble:(double)value __attribute__((unavailable)); +- (instancetype)initWithBool:(BOOL)value __attribute__((unavailable)); +- (instancetype)initWithInteger:(NSInteger)value __attribute__((unavailable)); +- (instancetype)initWithUnsignedInteger:(NSUInteger)value __attribute__((unavailable)); ++ (instancetype)numberWithChar:(char)value __attribute__((unavailable)); ++ (instancetype)numberWithUnsignedChar:(unsigned char)value __attribute__((unavailable)); ++ (instancetype)numberWithShort:(short)value __attribute__((unavailable)); ++ (instancetype)numberWithUnsignedShort:(unsigned short)value __attribute__((unavailable)); ++ (instancetype)numberWithInt:(int)value __attribute__((unavailable)); ++ (instancetype)numberWithUnsignedInt:(unsigned int)value __attribute__((unavailable)); ++ (instancetype)numberWithLong:(long)value __attribute__((unavailable)); ++ (instancetype)numberWithUnsignedLong:(unsigned long)value __attribute__((unavailable)); ++ (instancetype)numberWithLongLong:(long long)value __attribute__((unavailable)); ++ (instancetype)numberWithUnsignedLongLong:(unsigned long long)value __attribute__((unavailable)); ++ (instancetype)numberWithFloat:(float)value __attribute__((unavailable)); ++ (instancetype)numberWithDouble:(double)value __attribute__((unavailable)); ++ (instancetype)numberWithBool:(BOOL)value __attribute__((unavailable)); ++ (instancetype)numberWithInteger:(NSInteger)value __attribute__((unavailable)); ++ (instancetype)numberWithUnsignedInteger:(NSUInteger)value __attribute__((unavailable)); +@end; + +__attribute__((objc_runtime_name("KotlinByte"))) +__attribute__((swift_name("KotlinByte"))) +@interface ValuesByte : ValuesNumber +- (instancetype)initWithChar:(char)value; ++ (instancetype)numberWithChar:(char)value; +@end; + +__attribute__((objc_runtime_name("KotlinUByte"))) +__attribute__((swift_name("KotlinUByte"))) +@interface ValuesUByte : ValuesNumber +- (instancetype)initWithUnsignedChar:(unsigned char)value; ++ (instancetype)numberWithUnsignedChar:(unsigned char)value; +@end; + +__attribute__((objc_runtime_name("KotlinShort"))) +__attribute__((swift_name("KotlinShort"))) +@interface ValuesShort : ValuesNumber +- (instancetype)initWithShort:(short)value; ++ (instancetype)numberWithShort:(short)value; +@end; + +__attribute__((objc_runtime_name("KotlinUShort"))) +__attribute__((swift_name("KotlinUShort"))) +@interface ValuesUShort : ValuesNumber +- (instancetype)initWithUnsignedShort:(unsigned short)value; ++ (instancetype)numberWithUnsignedShort:(unsigned short)value; +@end; + +__attribute__((objc_runtime_name("KotlinInt"))) +__attribute__((swift_name("KotlinInt"))) +@interface ValuesInt : ValuesNumber +- (instancetype)initWithInt:(int)value; ++ (instancetype)numberWithInt:(int)value; +@end; + +__attribute__((objc_runtime_name("KotlinUInt"))) +__attribute__((swift_name("KotlinUInt"))) +@interface ValuesUInt : ValuesNumber +- (instancetype)initWithUnsignedInt:(unsigned int)value; ++ (instancetype)numberWithUnsignedInt:(unsigned int)value; +@end; + +__attribute__((objc_runtime_name("KotlinLong"))) +__attribute__((swift_name("KotlinLong"))) +@interface ValuesLong : ValuesNumber +- (instancetype)initWithLongLong:(long long)value; ++ (instancetype)numberWithLongLong:(long long)value; +@end; + +__attribute__((objc_runtime_name("KotlinULong"))) +__attribute__((swift_name("KotlinULong"))) +@interface ValuesULong : ValuesNumber +- (instancetype)initWithUnsignedLongLong:(unsigned long long)value; ++ (instancetype)numberWithUnsignedLongLong:(unsigned long long)value; +@end; + +__attribute__((objc_runtime_name("KotlinFloat"))) +__attribute__((swift_name("KotlinFloat"))) +@interface ValuesFloat : ValuesNumber +- (instancetype)initWithFloat:(float)value; ++ (instancetype)numberWithFloat:(float)value; +@end; + +__attribute__((objc_runtime_name("KotlinDouble"))) +__attribute__((swift_name("KotlinDouble"))) +@interface ValuesDouble : ValuesNumber +- (instancetype)initWithDouble:(double)value; ++ (instancetype)numberWithDouble:(double)value; +@end; + +__attribute__((objc_runtime_name("KotlinBoolean"))) +__attribute__((swift_name("KotlinBoolean"))) +@interface ValuesBoolean : ValuesNumber +- (instancetype)initWithBool:(BOOL)value; ++ (instancetype)numberWithBool:(BOOL)value; +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("DelegateClass"))) +@interface ValuesDelegateClass : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (ValuesKotlinArray *)getValueThisRef:(ValuesKotlinNothing * _Nullable)thisRef property:(id)property __attribute__((swift_name("getValue(thisRef:property:)"))); +- (void)setValueThisRef:(ValuesKotlinNothing * _Nullable)thisRef property:(id)property value:(ValuesKotlinArray *)value __attribute__((swift_name("setValue(thisRef:property:value:)"))); +@end; + +__attribute__((swift_name("I"))) +@protocol ValuesI +@required +- (NSString *)iFun __attribute__((swift_name("iFun()"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("DefaultInterfaceExt"))) +@interface ValuesDefaultInterfaceExt : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@end; + +__attribute__((swift_name("OpenClassI"))) +@interface ValuesOpenClassI : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (NSString *)iFun __attribute__((swift_name("iFun()"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("FinalClassExtOpen"))) +@interface ValuesFinalClassExtOpen : ValuesOpenClassI +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (NSString *)iFun __attribute__((swift_name("iFun()"))); +@end; + +__attribute__((swift_name("MultiExtClass"))) +@interface ValuesMultiExtClass : ValuesOpenClassI +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (id)piFun __attribute__((swift_name("piFun()"))); +- (NSString *)iFun __attribute__((swift_name("iFun()"))); +@end; + +__attribute__((swift_name("ConstrClass"))) +@interface ValuesConstrClass : ValuesOpenClassI +- (instancetype)initWithI:(int32_t)i s:(NSString *)s a:(id)a __attribute__((swift_name("init(i:s:a:)"))) __attribute__((objc_designated_initializer)); +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable)); ++ (instancetype)new __attribute__((unavailable)); +@property (readonly) int32_t i __attribute__((swift_name("i"))); +@property (readonly) NSString *s __attribute__((swift_name("s"))); +@property (readonly) id a __attribute__((swift_name("a"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("ExtConstrClass"))) +@interface ValuesExtConstrClass : ValuesConstrClass +- (instancetype)initWithI:(int32_t)i __attribute__((swift_name("init(i:)"))) __attribute__((objc_designated_initializer)); +- (instancetype)initWithI:(int32_t)i s:(NSString *)s a:(id)a __attribute__((swift_name("init(i:s:a:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable)); +- (NSString *)iFun __attribute__((swift_name("iFun()"))); +@property (readonly) int32_t i __attribute__((swift_name("i"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("Enumeration"))) +@interface ValuesEnumeration : ValuesKotlinEnum ++ (instancetype)alloc __attribute__((unavailable)); ++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable)); +@property (class, readonly) ValuesEnumeration *answer __attribute__((swift_name("answer"))); +@property (class, readonly) ValuesEnumeration *year __attribute__((swift_name("year"))); +@property (class, readonly) ValuesEnumeration *temperature __attribute__((swift_name("temperature"))); +- (instancetype)initWithName:(NSString *)name ordinal:(int32_t)ordinal __attribute__((swift_name("init(name:ordinal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable)); +- (int32_t)compareToOther:(ValuesEnumeration *)other __attribute__((swift_name("compareTo(other:)"))); +@property (readonly) int32_t enumValue __attribute__((swift_name("enumValue"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("TripleVals"))) +@interface ValuesTripleVals : KotlinBase +- (instancetype)initWithFirst:(id _Nullable)first second:(id _Nullable)second third:(id _Nullable)third __attribute__((swift_name("init(first:second:third:)"))) __attribute__((objc_designated_initializer)); +- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); +- (NSUInteger)hash __attribute__((swift_name("hash()"))); +- (NSString *)description __attribute__((swift_name("description()"))); +- (id _Nullable)component1 __attribute__((swift_name("component1()"))); +- (id _Nullable)component2 __attribute__((swift_name("component2()"))); +- (id _Nullable)component3 __attribute__((swift_name("component3()"))); +- (ValuesTripleVals *)doCopyFirst:(id _Nullable)first second:(id _Nullable)second third:(id _Nullable)third __attribute__((swift_name("doCopy(first:second:third:)"))); +@property (readonly) id _Nullable first __attribute__((swift_name("first"))); +@property (readonly) id _Nullable second __attribute__((swift_name("second"))); +@property (readonly) id _Nullable third __attribute__((swift_name("third"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("TripleVars"))) +@interface ValuesTripleVars : KotlinBase +- (instancetype)initWithFirst:(id _Nullable)first second:(id _Nullable)second third:(id _Nullable)third __attribute__((swift_name("init(first:second:third:)"))) __attribute__((objc_designated_initializer)); +- (NSString *)description __attribute__((swift_name("description()"))); +- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); +- (NSUInteger)hash __attribute__((swift_name("hash()"))); +- (id _Nullable)component1 __attribute__((swift_name("component1()"))); +- (id _Nullable)component2 __attribute__((swift_name("component2()"))); +- (id _Nullable)component3 __attribute__((swift_name("component3()"))); +- (ValuesTripleVars *)doCopyFirst:(id _Nullable)first second:(id _Nullable)second third:(id _Nullable)third __attribute__((swift_name("doCopy(first:second:third:)"))); +@property id _Nullable first __attribute__((swift_name("first"))); +@property id _Nullable second __attribute__((swift_name("second"))); +@property id _Nullable third __attribute__((swift_name("third"))); +@end; + +__attribute__((swift_name("WithCompanionAndObject"))) +@interface ValuesWithCompanionAndObject : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("WithCompanionAndObject.Companion"))) +@interface ValuesWithCompanionAndObjectCompanion : KotlinBase ++ (instancetype)alloc __attribute__((unavailable)); ++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable)); ++ (instancetype)companion __attribute__((swift_name("init()"))); +@property (readonly) NSString *str __attribute__((swift_name("str"))); +@property id _Nullable named __attribute__((swift_name("named"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("WithCompanionAndObject.Named"))) +@interface ValuesWithCompanionAndObjectNamed : ValuesOpenClassI ++ (instancetype)alloc __attribute__((unavailable)); ++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable)); ++ (instancetype)named __attribute__((swift_name("init()"))); +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable)); ++ (instancetype)new __attribute__((unavailable)); +- (NSString *)iFun __attribute__((swift_name("iFun()"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("MyException"))) +@interface ValuesMyException : ValuesKotlinException +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (instancetype)initWithMessage:(NSString * _Nullable)message __attribute__((swift_name("init(message:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable)); +- (instancetype)initWithMessage:(NSString * _Nullable)message cause:(ValuesKotlinThrowable * _Nullable)cause __attribute__((swift_name("init(message:cause:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable)); +- (instancetype)initWithCause:(ValuesKotlinThrowable * _Nullable)cause __attribute__((swift_name("init(cause:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable)); +@end; + +__attribute__((swift_name("BridgeBase"))) +@interface ValuesBridgeBase : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (id _Nullable)foo1AndReturnError:(NSError * _Nullable * _Nullable)error __attribute__((swift_name("foo1()"))); +- (BOOL)foo2AndReturnResult:(int32_t * _Nullable)result error:(NSError * _Nullable * _Nullable)error __attribute__((swift_name("foo2(result:)"))); +- (BOOL)foo3AndReturnError:(NSError * _Nullable * _Nullable)error __attribute__((swift_name("foo3()"))); +- (BOOL)foo4AndReturnResult:(ValuesKotlinNothing * _Nullable * _Nullable)result error:(NSError * _Nullable * _Nullable)error __attribute__((swift_name("foo4(result:)"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("Bridge"))) +@interface ValuesBridge : ValuesBridgeBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (ValuesKotlinNothing * _Nullable)foo1AndReturnError:(NSError * _Nullable * _Nullable)error __attribute__((swift_name("foo1()"))); +- (BOOL)foo2AndReturnResult:(int32_t * _Nullable)result error:(NSError * _Nullable * _Nullable)error __attribute__((swift_name("foo2(result:)"))); +- (BOOL)foo3AndReturnError:(NSError * _Nullable * _Nullable)error __attribute__((swift_name("foo3()"))); +- (BOOL)foo4AndReturnResult:(ValuesKotlinNothing ** _Nullable)result error:(NSError * _Nullable * _Nullable)error __attribute__((swift_name("foo4(result:)"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("Deeply"))) +@interface ValuesDeeply : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("Deeply.Nested"))) +@interface ValuesDeeplyNested : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("Deeply.NestedType"))) +@interface ValuesDeeplyNestedType : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@property (readonly) int32_t thirtyTwo __attribute__((swift_name("thirtyTwo"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("WithGenericDeeply"))) +@interface ValuesWithGenericDeeply : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("WithGenericDeeply.Nested"))) +@interface ValuesWithGenericDeeplyNested : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("WithGenericDeeply.NestedType"))) +@interface ValuesWithGenericDeeplyNestedType : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@property (readonly) int32_t thirtyThree __attribute__((swift_name("thirtyThree"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("CKeywords"))) +@interface ValuesCKeywords : KotlinBase +- (instancetype)initWithFloat:(float)float_ enum:(int32_t)enum_ goto:(BOOL)goto_ __attribute__((swift_name("init(float:enum:goto:)"))) __attribute__((objc_designated_initializer)); +- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)"))); +- (NSUInteger)hash __attribute__((swift_name("hash()"))); +- (NSString *)description __attribute__((swift_name("description()"))); +- (float)component1 __attribute__((swift_name("component1()"))); +- (int32_t)component2 __attribute__((swift_name("component2()"))); +- (BOOL)component3 __attribute__((swift_name("component3()"))); +- (ValuesCKeywords *)doCopyFloat:(float)float_ enum:(int32_t)enum_ goto:(BOOL)goto_ __attribute__((swift_name("doCopy(float:enum:goto:)"))); +@property (readonly, getter=float) float float_ __attribute__((swift_name("float_"))); +@property (readonly, getter=enum) int32_t enum_ __attribute__((swift_name("enum_"))); +@property (getter=goto, setter=setGoto:) BOOL goto_ __attribute__((swift_name("goto_"))); +@end; + +__attribute__((swift_name("Base1"))) +@protocol ValuesBase1 +@required +- (ValuesInt * _Nullable)sameValue:(ValuesInt * _Nullable)value __attribute__((swift_name("same(value:)"))); +@end; + +__attribute__((swift_name("ExtendedBase1"))) +@protocol ValuesExtendedBase1 +@required +@end; + +__attribute__((swift_name("Base2"))) +@protocol ValuesBase2 +@required +- (ValuesInt * _Nullable)sameValue:(ValuesInt * _Nullable)value __attribute__((swift_name("same(value:)"))); +@end; + +__attribute__((swift_name("Base23"))) +@interface ValuesBase23 : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (ValuesInt *)sameValue:(ValuesInt * _Nullable)value __attribute__((swift_name("same(value:)"))); +@end; + +__attribute__((swift_name("Transform"))) +@protocol ValuesTransform +@required +- (id _Nullable)mapValue:(id _Nullable)value __attribute__((swift_name("map(value:)"))); +@end; + +__attribute__((swift_name("TransformWithDefault"))) +@protocol ValuesTransformWithDefault +@required +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("TransformInheritingDefault"))) +@interface ValuesTransformInheritingDefault : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@end; + +__attribute__((swift_name("TransformIntString"))) +@protocol ValuesTransformIntString +@required +- (NSString *)mapIntValue:(int32_t)intValue __attribute__((swift_name("map(intValue:)"))); +@end; + +__attribute__((swift_name("TransformIntToString"))) +@interface ValuesTransformIntToString : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (NSString *)mapValue:(ValuesInt *)intValue __attribute__((swift_name("map(value:)"))); +- (NSString *)mapIntValue:(int32_t)intValue __attribute__((swift_name("map(intValue:)"))); +@end; + +__attribute__((swift_name("TransformIntToDecimalString"))) +@interface ValuesTransformIntToDecimalString : ValuesTransformIntToString +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (NSString *)mapValue:(ValuesInt *)intValue __attribute__((swift_name("map(value:)"))); +- (NSString *)mapIntValue:(int32_t)intValue __attribute__((swift_name("map(intValue:)"))); +@end; + +__attribute__((swift_name("TransformIntToLong"))) +@interface ValuesTransformIntToLong : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (ValuesLong *)mapValue:(ValuesInt *)value __attribute__((swift_name("map(value:)"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("GH2931"))) +@interface ValuesGH2931 : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("GH2931.Data"))) +@interface ValuesGH2931Data : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("GH2931.Holder"))) +@interface ValuesGH2931Holder : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +@property (readonly) ValuesGH2931Data *data __attribute__((swift_name("data"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("GH2945"))) +@interface ValuesGH2945 : KotlinBase +- (instancetype)initWithErrno:(int32_t)errno __attribute__((swift_name("init(errno:)"))) __attribute__((objc_designated_initializer)); +- (int32_t)testErrnoInSelectorP:(int32_t)p errno:(int32_t)errno __attribute__((swift_name("testErrnoInSelector(p:errno:)"))); +@property int32_t errno __attribute__((swift_name("errno"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("GH2830"))) +@interface ValuesGH2830 : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (id)getI __attribute__((swift_name("getI()"))); +@end; + +__attribute__((swift_name("GH2830I"))) +@protocol ValuesGH2830I +@required +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("GH2959"))) +@interface ValuesGH2959 : KotlinBase +- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)); ++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead"))); +- (NSArray> *)getIId:(int32_t)id __attribute__((swift_name("getI(id:)"))); +@end; + +__attribute__((swift_name("GH2959I"))) +@protocol ValuesGH2959I +@required +@property (readonly) int32_t id __attribute__((swift_name("id"))); +@end; + +__attribute__((swift_name("IntBlocks"))) +@protocol ValuesIntBlocks +@required +- (id _Nullable)getPlusOneBlock __attribute__((swift_name("getPlusOneBlock()"))); +- (int32_t)callBlockArgument:(int32_t)argument block:(id _Nullable)block __attribute__((swift_name("callBlock(argument:block:)"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("IntBlocksImpl"))) +@interface ValuesIntBlocksImpl : KotlinBase ++ (instancetype)alloc __attribute__((unavailable)); ++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable)); ++ (instancetype)intBlocksImpl __attribute__((swift_name("init()"))); +- (ValuesInt *(^)(ValuesInt *))getPlusOneBlock __attribute__((swift_name("getPlusOneBlock()"))); +- (int32_t)callBlockArgument:(int32_t)argument block:(ValuesInt *(^)(ValuesInt *))block __attribute__((swift_name("callBlock(argument:block:)"))); +@end; + +__attribute__((swift_name("UnitBlockCoercion"))) +@protocol ValuesUnitBlockCoercion +@required +- (id)coerceBlock:(void (^)(void))block __attribute__((swift_name("coerce(block:)"))); +- (void (^)(void))uncoerceBlock:(id)block __attribute__((swift_name("uncoerce(block:)"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("UnitBlockCoercionImpl"))) +@interface ValuesUnitBlockCoercionImpl : KotlinBase ++ (instancetype)alloc __attribute__((unavailable)); ++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable)); ++ (instancetype)unitBlockCoercionImpl __attribute__((swift_name("init()"))); +- (ValuesKotlinUnit *(^)(void))coerceBlock:(void (^)(void))block __attribute__((swift_name("coerce(block:)"))); +- (void (^)(void))uncoerceBlock:(ValuesKotlinUnit *(^)(void))block __attribute__((swift_name("uncoerce(block:)"))); +@end; + +__attribute__((swift_name("MyAbstractList"))) +@interface ValuesMyAbstractList : NSObject +@end; + +@interface ValuesEnumeration (ValuesKt) +- (ValuesEnumeration *)getAnswer __attribute__((swift_name("getAnswer()"))); +@end; + +__attribute__((objc_subclassing_restricted)) +__attribute__((swift_name("ValuesKt"))) +@interface ValuesValuesKt : KotlinBase ++ (ValuesBoolean * _Nullable)boxBooleanValue:(BOOL)booleanValue __attribute__((swift_name("box(booleanValue:)"))); ++ (ValuesByte * _Nullable)boxByteValue:(int8_t)byteValue __attribute__((swift_name("box(byteValue:)"))); ++ (ValuesShort * _Nullable)boxShortValue:(int16_t)shortValue __attribute__((swift_name("box(shortValue:)"))); ++ (ValuesInt * _Nullable)boxIntValue:(int32_t)intValue __attribute__((swift_name("box(intValue:)"))); ++ (ValuesLong * _Nullable)boxLongValue:(int64_t)longValue __attribute__((swift_name("box(longValue:)"))); ++ (ValuesUByte * _Nullable)boxUByteValue:(uint8_t)uByteValue __attribute__((swift_name("box(uByteValue:)"))); ++ (ValuesUShort * _Nullable)boxUShortValue:(uint16_t)uShortValue __attribute__((swift_name("box(uShortValue:)"))); ++ (ValuesUInt * _Nullable)boxUIntValue:(uint32_t)uIntValue __attribute__((swift_name("box(uIntValue:)"))); ++ (ValuesULong * _Nullable)boxULongValue:(uint64_t)uLongValue __attribute__((swift_name("box(uLongValue:)"))); ++ (ValuesFloat * _Nullable)boxFloatValue:(float)floatValue __attribute__((swift_name("box(floatValue:)"))); ++ (ValuesDouble * _Nullable)boxDoubleValue:(double)doubleValue __attribute__((swift_name("box(doubleValue:)"))); ++ (void)ensureEqualBooleansActual:(ValuesBoolean * _Nullable)actual expected:(BOOL)expected __attribute__((swift_name("ensureEqualBooleans(actual:expected:)"))); ++ (void)ensureEqualBytesActual:(ValuesByte * _Nullable)actual expected:(int8_t)expected __attribute__((swift_name("ensureEqualBytes(actual:expected:)"))); ++ (void)ensureEqualShortsActual:(ValuesShort * _Nullable)actual expected:(int16_t)expected __attribute__((swift_name("ensureEqualShorts(actual:expected:)"))); ++ (void)ensureEqualIntsActual:(ValuesInt * _Nullable)actual expected:(int32_t)expected __attribute__((swift_name("ensureEqualInts(actual:expected:)"))); ++ (void)ensureEqualLongsActual:(ValuesLong * _Nullable)actual expected:(int64_t)expected __attribute__((swift_name("ensureEqualLongs(actual:expected:)"))); ++ (void)ensureEqualUBytesActual:(ValuesUByte * _Nullable)actual expected:(uint8_t)expected __attribute__((swift_name("ensureEqualUBytes(actual:expected:)"))); ++ (void)ensureEqualUShortsActual:(ValuesUShort * _Nullable)actual expected:(uint16_t)expected __attribute__((swift_name("ensureEqualUShorts(actual:expected:)"))); ++ (void)ensureEqualUIntsActual:(ValuesUInt * _Nullable)actual expected:(uint32_t)expected __attribute__((swift_name("ensureEqualUInts(actual:expected:)"))); ++ (void)ensureEqualULongsActual:(ValuesULong * _Nullable)actual expected:(uint64_t)expected __attribute__((swift_name("ensureEqualULongs(actual:expected:)"))); ++ (void)ensureEqualFloatsActual:(ValuesFloat * _Nullable)actual expected:(float)expected __attribute__((swift_name("ensureEqualFloats(actual:expected:)"))); ++ (void)ensureEqualDoublesActual:(ValuesDouble * _Nullable)actual expected:(double)expected __attribute__((swift_name("ensureEqualDoubles(actual:expected:)"))); ++ (void)emptyFun __attribute__((swift_name("emptyFun()"))); ++ (NSString *)strFun __attribute__((swift_name("strFun()"))); ++ (id)argsFunI:(int32_t)i l:(int64_t)l d:(double)d s:(NSString *)s __attribute__((swift_name("argsFun(i:l:d:s:)"))); ++ (NSString *)funArgumentFoo:(NSString *(^)(void))foo __attribute__((swift_name("funArgument(foo:)"))); ++ (id _Nullable)genericFooT:(id _Nullable)t foo:(id _Nullable (^)(id _Nullable))foo __attribute__((swift_name("genericFoo(t:foo:)"))); ++ (id)fooGenericNumberR:(id)r foo:(id (^)(id))foo __attribute__((swift_name("fooGenericNumber(r:foo:)"))); ++ (NSArray *)varargToListArgs:(ValuesKotlinArray *)args __attribute__((swift_name("varargToList(args:)"))); ++ (NSString *)subExt:(NSString *)receiver i:(int32_t)i __attribute__((swift_name("subExt(_:i:)"))); ++ (NSString *)toString:(id _Nullable)receiver __attribute__((swift_name("toString(_:)"))); ++ (void)print:(id _Nullable)receiver __attribute__((swift_name("print(_:)"))); ++ (id _Nullable)boxChar:(unichar)receiver __attribute__((swift_name("boxChar(_:)"))); ++ (BOOL)isA:(id _Nullable)receiver __attribute__((swift_name("isA(_:)"))); ++ (NSString *)iFunExt:(id)receiver __attribute__((swift_name("iFunExt(_:)"))); ++ (ValuesEnumeration *)passEnum __attribute__((swift_name("passEnum()"))); ++ (void)receiveEnumE:(int32_t)e __attribute__((swift_name("receiveEnum(e:)"))); ++ (ValuesEnumeration *)getValue:(int32_t)value __attribute__((swift_name("get(value:)"))); ++ (ValuesWithCompanionAndObjectCompanion *)getCompanionObject __attribute__((swift_name("getCompanionObject()"))); ++ (ValuesWithCompanionAndObjectNamed *)getNamedObject __attribute__((swift_name("getNamedObject()"))); ++ (ValuesOpenClassI *)getNamedObjectInterface __attribute__((swift_name("getNamedObjectInterface()"))); ++ (id)boxIc1:(int32_t)ic1 __attribute__((swift_name("box(ic1:)"))); ++ (id)boxIc2:(id)ic2 __attribute__((swift_name("box(ic2:)"))); ++ (id)boxIc3:(id _Nullable)ic3 __attribute__((swift_name("box(ic3:)"))); ++ (NSString *)concatenateInlineClassValuesIc1:(int32_t)ic1 ic1N:(id _Nullable)ic1N ic2:(id)ic2 ic2N:(id _Nullable)ic2N ic3:(id _Nullable)ic3 ic3N:(id _Nullable)ic3N __attribute__((swift_name("concatenateInlineClassValues(ic1:ic1N:ic2:ic2N:ic3:ic3N:)"))); ++ (int32_t)getValue1:(int32_t)receiver __attribute__((swift_name("getValue1(_:)"))); ++ (ValuesInt * _Nullable)getValueOrNull1:(id _Nullable)receiver __attribute__((swift_name("getValueOrNull1(_:)"))); ++ (NSString *)getValue2:(id)receiver __attribute__((swift_name("getValue2(_:)"))); ++ (NSString * _Nullable)getValueOrNull2:(id _Nullable)receiver __attribute__((swift_name("getValueOrNull2(_:)"))); ++ (ValuesTripleVals * _Nullable)getValue3:(id _Nullable)receiver __attribute__((swift_name("getValue3(_:)"))); ++ (ValuesTripleVals * _Nullable)getValueOrNull3:(id _Nullable)receiver __attribute__((swift_name("getValueOrNull3(_:)"))); ++ (BOOL)isFrozenObj:(id)obj __attribute__((swift_name("isFrozen(obj:)"))); ++ (id)kotlinLambdaBlock:(id (^)(id))block __attribute__((swift_name("kotlinLambda(block:)"))); ++ (int64_t)multiplyInt:(int32_t)int_ long:(int64_t)long_ __attribute__((swift_name("multiply(int:long:)"))); ++ (id)same:(id)receiver __attribute__((swift_name("same(_:)"))); ++ (ValuesInt * _Nullable)callBase1:(id)base1 value:(ValuesInt * _Nullable)value __attribute__((swift_name("call(base1:value:)"))); ++ (ValuesInt * _Nullable)callExtendedBase1:(id)extendedBase1 value:(ValuesInt * _Nullable)value __attribute__((swift_name("call(extendedBase1:value:)"))); ++ (ValuesInt * _Nullable)callBase2:(id)base2 value:(ValuesInt * _Nullable)value __attribute__((swift_name("call(base2:value:)"))); ++ (int32_t)callBase3:(id)base3 value:(ValuesInt * _Nullable)value __attribute__((swift_name("call(base3:value:)"))); ++ (int32_t)callBase23:(ValuesBase23 *)base23 value:(ValuesInt * _Nullable)value __attribute__((swift_name("call(base23:value:)"))); ++ (id)createTransformDecimalStringToInt __attribute__((swift_name("createTransformDecimalStringToInt()"))); ++ (BOOL)runUnitBlockBlock:(void (^)(void))block __attribute__((swift_name("runUnitBlock(block:)"))); ++ (void (^)(void))asUnitBlockBlock:(id _Nullable (^)(void))block __attribute__((swift_name("asUnitBlock(block:)"))); ++ (BOOL)runNothingBlockBlock:(void (^)(void))block __attribute__((swift_name("runNothingBlock(block:)"))); ++ (void (^)(void))asNothingBlockBlock:(id _Nullable (^)(void))block __attribute__((swift_name("asNothingBlock(block:)"))); ++ (void (^ _Nullable)(void))getNullBlock __attribute__((swift_name("getNullBlock()"))); ++ (BOOL)isBlockNullBlock:(void (^ _Nullable)(void))block __attribute__((swift_name("isBlockNull(block:)"))); +@property (class, readonly) double dbl __attribute__((swift_name("dbl"))); +@property (class, readonly) float flt __attribute__((swift_name("flt"))); +@property (class, readonly) int32_t integer __attribute__((swift_name("integer"))); +@property (class, readonly) int64_t longInt __attribute__((swift_name("longInt"))); +@property (class) int32_t intVar __attribute__((swift_name("intVar"))); +@property (class) NSString *str __attribute__((swift_name("str"))); +@property (class) id strAsAny __attribute__((swift_name("strAsAny"))); +@property (class) id minDoubleVal __attribute__((swift_name("minDoubleVal"))); +@property (class) id maxDoubleVal __attribute__((swift_name("maxDoubleVal"))); +@property (class, readonly) double nanDoubleVal __attribute__((swift_name("nanDoubleVal"))); +@property (class, readonly) float nanFloatVal __attribute__((swift_name("nanFloatVal"))); +@property (class, readonly) double infDoubleVal __attribute__((swift_name("infDoubleVal"))); +@property (class, readonly) float infFloatVal __attribute__((swift_name("infFloatVal"))); +@property (class, readonly) BOOL boolVal __attribute__((swift_name("boolVal"))); +@property (class, readonly) id boolAnyVal __attribute__((swift_name("boolAnyVal"))); +@property (class, readonly) NSArray *numbersList __attribute__((swift_name("numbersList"))); +@property (class, readonly) NSArray *anyList __attribute__((swift_name("anyList"))); +@property (class) id lateinitIntVar __attribute__((swift_name("lateinitIntVar"))); +@property (class, readonly) NSString *lazyVal __attribute__((swift_name("lazyVal"))); +@property (class) ValuesKotlinArray *delegatedGlobalArray __attribute__((swift_name("delegatedGlobalArray"))); +@property (class, readonly) NSArray *delegatedList __attribute__((swift_name("delegatedList"))); +@property (class, readonly) id _Nullable nullVal __attribute__((swift_name("nullVal"))); +@property (class) NSString * _Nullable nullVar __attribute__((swift_name("nullVar"))); +@property (class) id anyValue __attribute__((swift_name("anyValue"))); +@property (class, readonly) ValuesInt *(^sumLambda)(ValuesInt *, ValuesInt *) __attribute__((swift_name("sumLambda"))); +@property (class, readonly) int32_t PROPERTY_NAME_MUST_NOT_BE_ALTERED_BY_SWIFT __attribute__((swift_name("PROPERTY_NAME_MUST_NOT_BE_ALTERED_BY_SWIFT"))); +@end; +