Diff if destructuring on a data class by default is prohibited
diff --git a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/components/KaFe10TypeProvider.kt b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/components/KaFe10TypeProvider.kt
index 0c4143d..40afe2a 100644
--- a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/components/KaFe10TypeProvider.kt
+++ b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/components/KaFe10TypeProvider.kt
@@ -280,7 +280,9 @@
queue.addLast(mappingForType)
while (queue.isNotEmpty()) {
- val (typeParameterOwner, mapping) = queue.removeFirst()
+ val initializer = queue.removeFirst()
+ val typeParameterOwner = initializer.owner
+ val mapping = initializer.mapping
for (superType in typeParameterOwner.typeConstructor.supertypes) {
val mappingForSupertype = superType.toTypeArgumentMapping(mapping) ?: continue
queue.addLast(mappingForSupertype)
diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KaFirExpressionTypeProvider.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KaFirExpressionTypeProvider.kt
index d8db8458f..1dadc0e 100644
--- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KaFirExpressionTypeProvider.kt
+++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KaFirExpressionTypeProvider.kt
@@ -225,7 +225,9 @@
}
private fun getExpectedTypeOfFunctionParameter(expression: PsiElement): KaType? {
- val (ktCallElement, argumentExpression) = expression.getFunctionCallAsWithThisAsParameter() ?: return null
+ val initializer = expression.getFunctionCallAsWithThisAsParameter() ?: return null
+ val ktCallElement = initializer.call
+ val argumentExpression = initializer.argument
val firCall = ktCallElement.getOrBuildFir(firResolveSession)?.unwrapSafeCall() as? FirCall ?: return null
val callee = (firCall.toReference(firResolveSession.useSiteFirSession) as? FirResolvedNamedReference)?.resolvedSymbol
@@ -237,16 +239,15 @@
}
val argumentsToParameters = firCall.argumentsToSubstitutedValueParameters(substituteWithErrorTypes = false) ?: return null
- val (firParameterForExpression, substitutedType) =
- argumentsToParameters.entries.firstOrNull { (arg, _) ->
- when (arg) {
- // TODO: better to utilize. See `createArgumentMapping` in [KtFirCallResolver]
- is FirNamedArgumentExpression, is FirSpreadArgumentExpression ->
- arg.psi == argumentExpression.parent
- else ->
- arg.psi == argumentExpression.unwrap()
- }
- }?.value ?: return null
+ val initializer2 = argumentsToParameters.entries.firstOrNull { (arg, _) ->
+ when (arg) {
+ // TODO: better to utilize. See `createArgumentMapping` in [KtFirCallResolver]
+ is FirNamedArgumentExpression, is FirSpreadArgumentExpression -> arg.psi == argumentExpression.parent
+ else -> arg.psi == argumentExpression.unwrap()
+ }
+ }?.value ?: return null
+ val firParameterForExpression = initializer2.parameter
+ val substitutedType = initializer2.substitutedType
return if (firParameterForExpression.isVararg)
substitutedType.varargElementType().asKtType()
else
diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KaFirImportOptimizer.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KaFirImportOptimizer.kt
index cf9d745..4879489 100644
--- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KaFirImportOptimizer.kt
+++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KaFirImportOptimizer.kt
@@ -60,7 +60,9 @@
val existingImports = file.importDirectives
if (existingImports.isEmpty()) return KaImportOptimizerResult()
- val (usedDeclarations, unresolvedNames) = collectReferencedEntities(file)
+ val initializer = collectReferencedEntities(file)
+ val usedDeclarations = initializer.usedImports
+ val unresolvedNames = initializer.unresolvedNames
return KaImportOptimizerResult(usedDeclarations, unresolvedNames)
}
diff --git a/analysis/analysis-api-platform-interface/src/org/jetbrains/kotlin/analysis/api/platform/declarations/KotlinFileBasedDeclarationProvider.kt b/analysis/analysis-api-platform-interface/src/org/jetbrains/kotlin/analysis/api/platform/declarations/KotlinFileBasedDeclarationProvider.kt
index b13d814..e091909 100644
--- a/analysis/analysis-api-platform-interface/src/org/jetbrains/kotlin/analysis/api/platform/declarations/KotlinFileBasedDeclarationProvider.kt
+++ b/analysis/analysis-api-platform-interface/src/org/jetbrains/kotlin/analysis/api/platform/declarations/KotlinFileBasedDeclarationProvider.kt
@@ -58,7 +58,9 @@
tasks += Task(startingChunks, kotlinFile)
while (!tasks.isEmpty()) {
- val (chunks, element) = tasks.removeFirst()
+ val initializer = tasks.removeFirst()
+ val chunks = initializer.chunks
+ val element = initializer.element
assert(chunks.isNotEmpty())
if (element !is KtNamedDeclaration || element.nameAsName != chunks[0]) {
diff --git a/analysis/analysis-api-standalone/analysis-api-standalone-base/src/org/jetbrains/kotlin/analysis/api/standalone/base/projectStructure/StandaloneProjectFactory.kt b/analysis/analysis-api-standalone/analysis-api-standalone-base/src/org/jetbrains/kotlin/analysis/api/standalone/base/projectStructure/StandaloneProjectFactory.kt
index 879ccf0..efa087a 100644
--- a/analysis/analysis-api-standalone/analysis-api-standalone-base/src/org/jetbrains/kotlin/analysis/api/standalone/base/projectStructure/StandaloneProjectFactory.kt
+++ b/analysis/analysis-api-standalone/analysis-api-standalone-base/src/org/jetbrains/kotlin/analysis/api/standalone/base/projectStructure/StandaloneProjectFactory.kt
@@ -240,7 +240,10 @@
}
val (roots, singleJavaFileRoots) =
- rootsWithSingleJavaFileRoots.partition { (file) -> file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION }
+ rootsWithSingleJavaFileRoots.partition { initializer ->
+ val file = initializer.file
+ file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION
+ }
val corePackageIndex = project.getService(PackageIndex::class.java) as CorePackageIndex
val rootsIndex = JvmDependenciesDynamicCompoundIndex().apply {
diff --git a/analysis/decompiled/decompiler-to-stubs/src/org/jetbrains/kotlin/analysis/decompiler/stub/ClassClsStubBuilder.kt b/analysis/decompiled/decompiler-to-stubs/src/org/jetbrains/kotlin/analysis/decompiler/stub/ClassClsStubBuilder.kt
index e2493f8..823d565 100644
--- a/analysis/decompiled/decompiler-to-stubs/src/org/jetbrains/kotlin/analysis/decompiler/stub/ClassClsStubBuilder.kt
+++ b/analysis/decompiled/decompiler-to-stubs/src/org/jetbrains/kotlin/analysis/decompiler/stub/ClassClsStubBuilder.kt
@@ -251,32 +251,34 @@
}
private fun createNestedClassStub(classBody: StubElement<out PsiElement>, nestedClassId: ClassId) {
- val (nameResolver, classProto, _, sourceElement) =
- c.components.classDataFinder.findClassData(nestedClassId)
- ?: c.components.virtualFileForDebug.let { rootFile ->
- if (LOG.isDebugEnabled) {
- val outerClassId = nestedClassId.outerClassId
- val sortedChildren = rootFile.parent.children.sortedBy { it.name }
- val msgPrefix = "Could not find data for nested class $nestedClassId of class $outerClassId\n"
- val explanation = when {
- outerClassId != null && sortedChildren.none { it.name.startsWith("${outerClassId.relativeClassName}\$a") } ->
- // KT-29427: case with obfuscation
- "Reason: obfuscation suspected (single-letter name)\n"
- else ->
- // General case
- ""
- }
- val msg = msgPrefix + explanation +
- "Root file: ${rootFile.canonicalPath}\n" +
- "Dir: ${rootFile.parent.canonicalPath}\n" +
- "Children:\n" +
- sortedChildren.joinToString(separator = "\n") {
- "${it.name} (valid: ${it.isValid})"
- }
- LOG.debug(msg)
+ val initializer = c.components.classDataFinder.findClassData(nestedClassId)
+ ?: c.components.virtualFileForDebug.let { rootFile ->
+ if (LOG.isDebugEnabled) {
+ val outerClassId = nestedClassId.outerClassId
+ val sortedChildren = rootFile.parent.children.sortedBy { it.name }
+ val msgPrefix = "Could not find data for nested class $nestedClassId of class $outerClassId\n"
+ val explanation = when {
+ outerClassId != null && sortedChildren.none { it.name.startsWith("${outerClassId.relativeClassName}\$a") } ->
+ // KT-29427: case with obfuscation
+ "Reason: obfuscation suspected (single-letter name)\n"
+ else ->
+ // General case
+ ""
}
- return
+ val msg = msgPrefix + explanation +
+ "Root file: ${rootFile.canonicalPath}\n" +
+ "Dir: ${rootFile.parent.canonicalPath}\n" +
+ "Children:\n" +
+ sortedChildren.joinToString(separator = "\n") {
+ "${it.name} (valid: ${it.isValid})"
+ }
+ LOG.debug(msg)
}
+ return
+ }
+ val nameResolver = initializer.nameResolver
+ val classProto = initializer.classProto
+ val sourceElement = initializer.sourceElement
createClassStub(classBody, classProto, nameResolver, nestedClassId, sourceElement, c)
}
diff --git a/analysis/decompiled/decompiler-to-stubs/src/org/jetbrains/kotlin/analysis/decompiler/stub/clsStubBuilding.kt b/analysis/decompiled/decompiler-to-stubs/src/org/jetbrains/kotlin/analysis/decompiler/stub/clsStubBuilding.kt
index 52710df..e85aa5b 100644
--- a/analysis/decompiled/decompiler-to-stubs/src/org/jetbrains/kotlin/analysis/decompiler/stub/clsStubBuilding.kt
+++ b/analysis/decompiled/decompiler-to-stubs/src/org/jetbrains/kotlin/analysis/decompiler/stub/clsStubBuilding.kt
@@ -215,7 +215,8 @@
if (annotations.isEmpty()) return
annotations.forEach { annotation ->
- val (annotationWithArgs, target) = annotation
+ val annotationWithArgs = annotation.annotationWithArgs
+ val target = annotation.target
val annotationEntryStubImpl = KotlinAnnotationEntryStubImpl(
parent,
shortName = annotationWithArgs.classId.shortClassName.ref(),
diff --git a/build-common/src/org/jetbrains/kotlin/incremental/AbstractIncrementalCache.kt b/build-common/src/org/jetbrains/kotlin/incremental/AbstractIncrementalCache.kt
index 163b34b..eb1fe97 100644
--- a/build-common/src/org/jetbrains/kotlin/incremental/AbstractIncrementalCache.kt
+++ b/build-common/src/org/jetbrains/kotlin/incremental/AbstractIncrementalCache.kt
@@ -127,7 +127,9 @@
* The `srcFile` argument may be `null` (e.g., if we are processing .class files in jars where source files are not available).
*/
protected fun addToClassStorage(classProtoData: ClassProtoData, srcFile: File?, useCompilerMapsOnly: Boolean = false) {
- val (proto, nameResolver) = classProtoData
+ val initializer = classProtoData
+ val proto = initializer.proto
+ val nameResolver = initializer.nameResolver
val supertypes = proto.supertypes(TypeTable(proto.typeTable))
val parents = supertypes.map { nameResolver.getClassId(it.className).asSingleFqName() }
diff --git a/build-common/src/org/jetbrains/kotlin/incremental/IncrementalJsCache.kt b/build-common/src/org/jetbrains/kotlin/incremental/IncrementalJsCache.kt
index 47ac8b4..929aadf 100644
--- a/build-common/src/org/jetbrains/kotlin/incremental/IncrementalJsCache.kt
+++ b/build-common/src/org/jetbrains/kotlin/incremental/IncrementalJsCache.kt
@@ -108,7 +108,9 @@
for ((srcFile, data) in translatedFiles) {
dirtySources.remove(srcFile)
- val (binaryMetadata, binaryAst, inlineData) = data
+ val binaryMetadata = data.metadata
+ val binaryAst = data.binaryAst
+ val inlineData = data.inlineData
val oldProtoMap = translationResults[srcFile]?.metadata?.let { protoData(srcFile, it) } ?: emptyMap()
val newProtoMap = protoData(srcFile, binaryMetadata)
@@ -137,7 +139,15 @@
}
for ((srcFile, irData) in incrementalResults.irFileData) {
- val (fileData, types, signatures, strings, declarations, bodies, fqn, fileMetadata, debugInfos) = irData
+ val fileData = irData.fileData
+ val types = irData.types
+ val signatures = irData.signatures
+ val strings = irData.strings
+ val declarations = irData.declarations
+ val bodies = irData.bodies
+ val fqn = irData.fqn
+ val fileMetadata = irData.fileMetadata
+ val debugInfos = irData.debugInfo
irTranslationResults.put(srcFile, fileData, types, signatures, strings, declarations, bodies, fqn, fileMetadata, debugInfos)
}
}
diff --git a/build-common/src/org/jetbrains/kotlin/incremental/buildUtil.kt b/build-common/src/org/jetbrains/kotlin/incremental/buildUtil.kt
index 3265899..0c3949d 100644
--- a/build-common/src/org/jetbrains/kotlin/incremental/buildUtil.kt
+++ b/build-common/src/org/jetbrains/kotlin/incremental/buildUtil.kt
@@ -115,7 +115,9 @@
}
}
- javaChangesTracker?.javaClassesUpdates?.forEach { (source, serializedJavaClass) ->
+ javaChangesTracker?.javaClassesUpdates?.forEach { initializer ->
+ val source = initializer.source
+ val serializedJavaClass = initializer.proto
cache.saveJavaClassProto(source, serializedJavaClass, changesCollector)
}
diff --git a/build-common/src/org/jetbrains/kotlin/incremental/protoDifferenceUtils.kt b/build-common/src/org/jetbrains/kotlin/incremental/protoDifferenceUtils.kt
index 0c8eb9f..841c9f5 100644
--- a/build-common/src/org/jetbrains/kotlin/incremental/protoDifferenceUtils.kt
+++ b/build-common/src/org/jetbrains/kotlin/incremental/protoDifferenceUtils.kt
@@ -184,8 +184,12 @@
)
override fun difference(): Difference {
- val (oldProto, oldNameResolver) = oldData
- val (newProto, newNameResolver) = newData
+ val initializer = oldData
+ val oldProto = initializer.proto
+ val oldNameResolver = initializer.nameResolver
+ val initializer2 = newData
+ val newProto = initializer2.proto
+ val newNameResolver = initializer2.nameResolver
val diff = compareObject.difference(oldProto, newProto)
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/CollectionStubMethodGenerator.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/CollectionStubMethodGenerator.kt
index 487dd8a..d5f0516 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/CollectionStubMethodGenerator.kt
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/CollectionStubMethodGenerator.kt
@@ -79,7 +79,9 @@
val syntheticStubsToGenerate = LinkedHashSet<JvmMethodGenericSignature>()
val bridgesToGenerate = LinkedHashSet<FunctionDescriptor>()
- for ((readOnlyClass, mutableClass) in superCollectionClasses) {
+ for (initializer in superCollectionClasses) {
+ val readOnlyClass = initializer.readOnlyClass
+ val mutableClass = initializer.mutableClass
// To determine which method stubs we need to generate, we create a synthetic class (named 'child' here) which inherits from
// our class ('descriptor') and the corresponding MutableCollection class (for example; the process is the same for every
// built-in read-only/mutable class pair). We then construct and bind fake overrides in this synthetic class with the usual
@@ -174,7 +176,10 @@
}
fun generate(functionCodegen: FunctionCodegen, v: ClassBuilder) {
- val (methodStubsToGenerate, syntheticStubsToGenerate, bridgesToGenerate) = computeTasksToGenerate()
+ val initializer = computeTasksToGenerate()
+ val methodStubsToGenerate = initializer.methodStubsToGenerate
+ val syntheticStubsToGenerate = initializer.syntheticStubsToGenerate
+ val bridgesToGenerate = initializer.bridgesToGenerate
for (signature in methodStubsToGenerate) {
generateMethodStub(v, signature, synthetic = false)
@@ -220,16 +225,22 @@
val allSuperClasses = TypeUtils.getAllSupertypes(descriptor.defaultType).mapTo(HashSet(), KotlinType::constructor)
- val ourSuperCollectionClasses = collectionClasses.filter { (readOnlyClass, mutableClass) ->
+ val ourSuperCollectionClasses = collectionClasses.filter { initializer ->
+ val readOnlyClass = initializer.readOnlyClass
+ val mutableClass = initializer.mutableClass
readOnlyClass in allSuperClasses && mutableClass !in allSuperClasses
}
if (ourSuperCollectionClasses.isEmpty()) return emptySet()
// Filter out built-in classes which are overridden by other built-in classes in the list, to avoid duplicating methods.
- val redundantClasses = ourSuperCollectionClasses.flatMapTo(HashSet()) { (readOnlyClass) ->
+ val redundantClasses = ourSuperCollectionClasses.flatMapTo(HashSet()) { initializer ->
+ val readOnlyClass = initializer.readOnlyClass
readOnlyClass.supertypes.map(KotlinType::constructor)
}
- return ourSuperCollectionClasses.filter { (readOnlyClass) -> readOnlyClass !in redundantClasses }
+ return ourSuperCollectionClasses.filter { initializer ->
+ val readOnlyClass = initializer.readOnlyClass
+ readOnlyClass !in redundantClasses
+ }
}
private fun findFakeOverridesForMethodsFromMutableCollection(
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegenForDefaultBody.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegenForDefaultBody.kt
index e941148..fbd473a 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegenForDefaultBody.kt
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineCodegenForDefaultBody.kt
@@ -38,7 +38,9 @@
override fun genCallInner(callableMethod: Callable, resolvedCall: ResolvedCall<*>?, callDefault: Boolean, codegen: ExpressionCodegen) {
assert(!callDefault) { "inlining default stub into another default stub" }
- val (node, smap) = sourceCompilerForInline.compileInlineFunction(jvmSignature)
+ val initializer = sourceCompilerForInline.compileInlineFunction(jvmSignature)
+ val node = initializer.node
+ val smap = initializer.classSMAP
val argsSize = argumentsSize(jvmSignature.asmMethod.descriptor, callableMethod.isStaticCall())
val mv = object : MethodBodyVisitor(codegen.visitor) {
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineScopesGenerator.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineScopesGenerator.kt
index 414b74f..8d7a4bf 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineScopesGenerator.kt
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/InlineScopesGenerator.kt
@@ -344,7 +344,10 @@
updateCallSiteLineNumber(name) { newLineNumber }
fun updateCallSiteLineNumber(name: String, calculate: (Int) -> Int): String {
- val (scopeNumber, callSiteLineNumber, surroundingScopeNumber) = name.getInlineScopeInfo() ?: return name
+ val initializer = name.getInlineScopeInfo() ?: return name
+ val scopeNumber = initializer.scopeNumber
+ val callSiteLineNumber = initializer.callSiteLineNumber
+ val surroundingScopeNumber = initializer.surroundingScopeNumber
if (callSiteLineNumber == null) {
return name
}
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LambdaInfo.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LambdaInfo.kt
index f11ddd9..124e8d5 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LambdaInfo.kt
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LambdaInfo.kt
@@ -132,7 +132,9 @@
capturedParamDesc(fieldNode.name, Type.getType(fieldNode.desc), isSuspend = false)
}?.toList() ?: emptyList()
isBoundCallableReference = isReference && capturedVars.isNotEmpty()
- val (originNode, classSmap) = loadDefaultLambdaBody(classBytes, lambdaClassType, isPropertyReference)
+ val initializer = loadDefaultLambdaBody(classBytes, lambdaClassType, isPropertyReference)
+ val originNode = initializer.node
+ val classSmap = initializer.classSMAP
node = SMAPAndMethodNode(createNodeWithFakeVariables(originNode), classSmap)
}
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/MethodInliner.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/MethodInliner.kt
index f4e4f8b..117bdcb 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/MethodInliner.kt
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/MethodInliner.kt
@@ -1338,7 +1338,10 @@
}
private fun incrementScopeNumbers(name: String): String {
- val (scopeNumber, callSiteLineNumber, surroundingScopeNumber) = name.getInlineScopeInfo() ?: return name
+ val initializer = name.getInlineScopeInfo() ?: return name
+ val scopeNumber = initializer.scopeNumber
+ val callSiteLineNumber = initializer.callSiteLineNumber
+ val surroundingScopeNumber = initializer.surroundingScopeNumber
return buildString {
append(name.dropInlineScopeInfo())
append(INLINE_SCOPE_NUMBER_SEPARATOR)
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/SMAP.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/SMAP.kt
index 89e070a..5d9ff0d 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/SMAP.kt
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/SMAP.kt
@@ -28,8 +28,14 @@
val debugMappings = linkedMapOf<Pair<String, String>, FileMapping>()
for (fileMapping in fileMappings) {
- for ((_, dest, range, callSite) in fileMapping.lineMappings) {
- callSite?.let { (line, file, path) ->
+ for (initializer in fileMapping.lineMappings) {
+ val dest = initializer.dest
+ val range = initializer.range
+ val callSite = initializer.callSite
+ callSite?.let { initializer2 ->
+ val line = initializer2.line
+ val file = initializer2.file
+ val path = initializer2.path
debugMappings.getOrPut(file to path) { FileMapping(file, path) }.mapNewInterval(line, dest, range)
}
}
diff --git a/compiler/build-tools/kotlin-build-tools-impl/src/main/kotlin/org/jetbrains/kotlin/buildtools/internal/CompilationServiceImpl.kt b/compiler/build-tools/kotlin-build-tools-impl/src/main/kotlin/org/jetbrains/kotlin/buildtools/internal/CompilationServiceImpl.kt
index 8a6b5c9..0ef56a2 100644
--- a/compiler/build-tools/kotlin-build-tools-impl/src/main/kotlin/org/jetbrains/kotlin/buildtools/internal/CompilationServiceImpl.kt
+++ b/compiler/build-tools/kotlin-build-tools-impl/src/main/kotlin/org/jetbrains/kotlin/buildtools/internal/CompilationServiceImpl.kt
@@ -209,7 +209,7 @@
}
}
- val (daemon, sessionId) = KotlinCompilerRunnerUtils.newDaemonConnection(
+ val initializer = KotlinCompilerRunnerUtils.newDaemonConnection(
compilerId,
clientIsAliveFile,
sessionIsAliveFlagFile,
@@ -217,6 +217,8 @@
false,
daemonJVMOptions = jvmOptions
) ?: return ExitCode.INTERNAL_ERROR.asCompilationResult
+ val daemon = initializer.compileService
+ val sessionId = initializer.sessionId
val daemonCompileOptions = compilationConfiguration.asDaemonCompilationOptions
val exitCode = daemon.compile(
sessionId,
diff --git a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/ClasspathRootsResolver.kt b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/ClasspathRootsResolver.kt
index 881b0c7..d8031dd 100644
--- a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/ClasspathRootsResolver.kt
+++ b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/ClasspathRootsResolver.kt
@@ -100,7 +100,9 @@
val hasOutputDirectoryInClasspath = outputDirectory in jvmClasspathRoots || outputDirectory in jvmModulePathRoots
- for ((root, packagePrefix) in javaSourceRoots) {
+ for (initializer in javaSourceRoots) {
+ val root = initializer.root
+ val packagePrefix = initializer.packagePrefix
val modularRoot = modularSourceRoot(root, hasOutputDirectoryInClasspath)
if (modularRoot != null) {
modules += modularRoot
diff --git a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/JvmPackagePartProvider.kt b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/JvmPackagePartProvider.kt
index de24687..527a68b 100644
--- a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/JvmPackagePartProvider.kt
+++ b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/JvmPackagePartProvider.kt
@@ -44,7 +44,9 @@
override val loadedModules: MutableList<ModuleMappingInfo<VirtualFile>> = SmartList()
fun addRoots(roots: List<JavaRoot>, messageCollector: MessageCollector) {
- for ((root, type) in roots) {
+ for (initializer in roots) {
+ val root = initializer.file
+ val type = initializer.type
if (type != JavaRoot.RootType.BINARY) continue
if (root !in scope) continue
diff --git a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCliJavaFileManagerImpl.kt b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCliJavaFileManagerImpl.kt
index a53cdaa..c265707 100644
--- a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCliJavaFileManagerImpl.kt
+++ b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCliJavaFileManagerImpl.kt
@@ -102,7 +102,9 @@
fun findClass(classId: ClassId, searchScope: GlobalSearchScope) = findClass(JavaClassFinder.Request(classId), searchScope)
override fun findClass(request: JavaClassFinder.Request, searchScope: GlobalSearchScope): JavaClass? {
- val (classId, classFileContentFromRequest, outerClassFromRequest) = request
+ val classId = request.classId
+ val classFileContentFromRequest = request.previouslyFoundClassFileContent
+ val outerClassFromRequest = request.outerClass
val virtualFile = findVirtualFileForTopLevelClass(classId, searchScope) ?: return null
if (!usePsiClassFilesReading && (virtualFile.extension == "class" || virtualFile.extension == "sig")) {
diff --git a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt
index a6f4e8d..1c390b4 100644
--- a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt
+++ b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt
@@ -267,11 +267,16 @@
hasKotlinSources = contentRoots.any { it is KotlinSourceRoot },
)
- val (initialRoots, javaModules) = classpathRootsResolver.convertClasspathRoots(contentRoots)
+ val initializer = classpathRootsResolver.convertClasspathRoots(contentRoots)
+ val initialRoots = initializer.roots
+ val javaModules = initializer.modules
this.initialRoots.addAll(initialRoots)
val (roots, singleJavaFileRoots) =
- initialRoots.partition { (file) -> file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION }
+ initialRoots.partition { initializer ->
+ val file = initializer.file
+ file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION
+ }
// REPL and kapt2 update classpath dynamically
rootsIndex = JvmDependenciesDynamicCompoundIndex().apply {
@@ -403,7 +408,8 @@
return rootsIndex.addNewIndexForRoots(newRoots)?.let { newIndex ->
updateClasspathFromRootsIndex(newIndex)
- newIndex.indexedRoots.mapNotNull { (file) ->
+ newIndex.indexedRoots.mapNotNull { initializer ->
+ val file = initializer.file
VfsUtilCore.virtualToIoFile(VfsUtilCore.getVirtualFileForJar(file) ?: file)
}.toList()
}.orEmpty()
diff --git a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/cliJavaModuleUtils.kt b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/cliJavaModuleUtils.kt
index b89ba08..78453d6e 100644
--- a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/cliJavaModuleUtils.kt
+++ b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/cliJavaModuleUtils.kt
@@ -10,7 +10,10 @@
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModule
fun JavaModule.getJavaModuleRoots(): List<JavaRoot> =
- moduleRoots.map { (root, isBinary, isBinarySignature) ->
+ moduleRoots.map { initializer ->
+ val root = initializer.file
+ val isBinary = initializer.isBinary
+ val isBinarySignature = initializer.isBinarySignature
val type = when {
isBinarySignature -> JavaRoot.RootType.BINARY_SIG
isBinary -> JavaRoot.RootType.BINARY
diff --git a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/coreEnvironmentUtils.kt b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/coreEnvironmentUtils.kt
index a5dd808..8390291 100644
--- a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/coreEnvironmentUtils.kt
+++ b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/compiler/coreEnvironmentUtils.kt
@@ -53,7 +53,10 @@
}
}
- for ((sourceRootPath, isCommon, hmppModuleName) in this) {
+ for (initializer in this) {
+ val sourceRootPath = initializer.path
+ val isCommon = initializer.isCommon
+ val hmppModuleName = initializer.hmppModuleName
val sourceRoot = File(sourceRootPath)
val vFile = localFileSystem.findFileByPath(sourceRoot.normalize().path)
if (vFile == null) {
diff --git a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/index/SingleJavaFileRootsIndex.kt b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/index/SingleJavaFileRootsIndex.kt
index 01fbc6c..05344c5 100644
--- a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/index/SingleJavaFileRootsIndex.kt
+++ b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/index/SingleJavaFileRootsIndex.kt
@@ -28,7 +28,8 @@
class SingleJavaFileRootsIndex(private val roots: List<JavaRoot>) {
init {
- for ((file) in roots) {
+ for (initializer in roots) {
+ val file = initializer.file
assert(!file.isDirectory) { "Should not be a directory: $file" }
}
}
diff --git a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/modules/CliJavaModuleResolver.kt b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/modules/CliJavaModuleResolver.kt
index f65c778..977fa17 100644
--- a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/modules/CliJavaModuleResolver.kt
+++ b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/modules/CliJavaModuleResolver.kt
@@ -65,7 +65,11 @@
}
private operator fun JavaModule.contains(file: VirtualFile): Boolean =
- moduleRoots.any { (root, isBinary) -> isBinary && VfsUtilCore.isAncestor(root, file, false) }
+ moduleRoots.any { initializer ->
+ val root = initializer.file
+ val isBinary = initializer.isBinary
+ isBinary && VfsUtilCore.isAncestor(root, file, false)
+ }
override fun checkAccessibility(
fileFromOurModule: VirtualFile?, referencedFile: VirtualFile, referencedPackage: FqName?
diff --git a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/modules/JavaModuleGraph.kt b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/modules/JavaModuleGraph.kt
index 2759d7b..52b77c6 100644
--- a/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/modules/JavaModuleGraph.kt
+++ b/compiler/cli/cli-base/src/org/jetbrains/kotlin/cli/jvm/modules/JavaModuleGraph.kt
@@ -33,7 +33,9 @@
fun dfs(moduleName: String): Boolean {
// Automatic modules have no transitive exports, so we only consider explicit modules here
val moduleInfo = (module(moduleName) as? JavaModule.Explicit)?.moduleInfo ?: return false
- for ((dependencyModuleName, isTransitive) in moduleInfo.requires) {
+ for (initializer in moduleInfo.requires) {
+ val dependencyModuleName = initializer.moduleName
+ val isTransitive = initializer.isTransitive
if (isTransitive && visited.add(dependencyModuleName)) {
dfs(dependencyModuleName)
}
@@ -48,7 +50,9 @@
// Do nothing; all automatic modules should be added to compilation roots at call site as per java.lang.module javadoc
}
is JavaModule.Explicit -> {
- for ((dependencyModuleName, isTransitive) in module.moduleInfo.requires) {
+ for (initializer in module.moduleInfo.requires) {
+ val dependencyModuleName = initializer.moduleName
+ val isTransitive = initializer.isTransitive
if (visited.add(dependencyModuleName)) {
val moduleExists = dfs(dependencyModuleName)
//ct.sym can miss some internal modules from non-transitive dependencies
@@ -75,7 +79,9 @@
when (module) {
is JavaModule.Automatic -> return true
is JavaModule.Explicit -> {
- for ((dependencyModuleName, isTransitive) in module.moduleInfo.requires) {
+ for (initializer in module.moduleInfo.requires) {
+ val dependencyModuleName = initializer.moduleName
+ val isTransitive = initializer.isTransitive
if (dependencyModuleName == dependencyName) return true
if (isTransitive && dfs(dependencyModuleName)) return true
@@ -92,7 +98,8 @@
when (module) {
is JavaModule.Automatic -> return true
is JavaModule.Explicit -> {
- for ((dependencyModuleName) in module.moduleInfo.requires) {
+ for (initializer in module.moduleInfo.requires) {
+ val dependencyModuleName = initializer.moduleName
if (dfs(dependencyModuleName)) return true
}
}
diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt
index 79595ae..d8a2ed4 100644
--- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt
+++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt
@@ -921,7 +921,9 @@
var standaloneSamConversionFeaturePassedExplicitly = false
var functionReferenceWithDefaultValueFeaturePassedExplicitly = false
- for ((feature, state) in internalArguments.filterIsInstance<ManualLanguageFeatureSetting>()) {
+ for (initializer in internalArguments.filterIsInstance<ManualLanguageFeatureSetting>()) {
+ val feature = initializer.languageFeature
+ val state = initializer.state
put(feature, state)
if (state == LanguageFeature.State.ENABLED && feature.forcesPreReleaseBinariesIfEnabled()) {
featuresThatForcePreReleaseBinaries += feature
diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/parseCommandLineArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/parseCommandLineArguments.kt
index 9d27342..cc0d63a 100644
--- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/parseCommandLineArguments.kt
+++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/parseCommandLineArguments.kt
@@ -202,7 +202,10 @@
continue
}
- val (getter, setter, argument) = argumentField
+ val initializer = argumentField
+ val getter = initializer.getter
+ val setter = initializer.setter
+ val argument = initializer.argument
// Tests for -shortName=value, which isn't currently allowed.
if (key != arg && key == argument.shortName) {
diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/KotlinJsr223JvmInvocableScriptEngine.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/KotlinJsr223JvmInvocableScriptEngine.kt
index 711dd8a..2c4cb54 100644
--- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/KotlinJsr223JvmInvocableScriptEngine.kt
+++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/KotlinJsr223JvmInvocableScriptEngine.kt
@@ -60,7 +60,10 @@
private fun invokeImpl(prioritizedCallOrder: List<EvalClassWithInstanceAndLoader>, name: String, args: Array<out Any?>): Any? {
// TODO: cache the method lookups?
- val (fn, mapping, invokeWrapper) = prioritizedCallOrder.asSequence().map { (klass, instance, _, invokeWrapper) ->
+ val (fn, mapping, invokeWrapper) = prioritizedCallOrder.asSequence().map { initializer ->
+ val klass = initializer.klass
+ val instance = initializer.instance
+ val invokeWrapper = initializer.invokeWrapper
val candidates = klass.functions.filter { it.name == name }
candidates.findMapping(listOf(instance) + args)?.let {
Triple(it.first, it.second, invokeWrapper)
diff --git a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt
index aa404f8..dbde53b 100644
--- a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt
+++ b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt
@@ -359,7 +359,9 @@
relativeRequirePath = true
)
- val (outputs, rebuiltModules) = jsExecutableProducer.buildExecutable(arguments.granularity, outJsProgram = false)
+ val initializer = jsExecutableProducer.buildExecutable(arguments.granularity, outJsProgram = false)
+ val outputs = initializer.compilationOut
+ val rebuiltModules = initializer.buildModules
outputs.writeAll(outputDir, outputName, arguments.dtsStrategy, moduleName, moduleKind)
icCaches.cacheGuard.release()
@@ -411,7 +413,7 @@
loadFunctionInterfacesIntoStdlib = true,
)
- val (allModules, backendContext, typeScriptFragment) = compileToLoweredIr(
+ val initializer = compileToLoweredIr(
irModuleInfo,
module.mainModule,
configuration,
@@ -421,6 +423,9 @@
generateTypeScriptFragment = generateDts,
propertyLazyInitialization = arguments.irPropertyLazyInitialization,
)
+ val allModules = initializer.loweredIr
+ val backendContext = initializer.backendContext
+ val typeScriptFragment = initializer.typeScriptFragment
performanceManager?.notifyIRGenerationStarted()
val dceDumpNameCache = DceDumpNameCache()
diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.kt
index 876225b..041795d 100644
--- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.kt
+++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.kt
@@ -183,7 +183,8 @@
if (!arguments.disableDefaultScriptingPlugin) {
scriptingPluginOptions.addPlatformOptions(arguments)
val explicitScriptingPlugin =
- extractPluginClasspathAndOptions(pluginConfigurations).any { (_, classpath, _) ->
+ extractPluginClasspathAndOptions(pluginConfigurations).any { initializer ->
+ val classpath = initializer.classpath
classpath.any { File(it).name.startsWith(PathUtil.KOTLIN_SCRIPTING_COMPILER_PLUGIN_NAME) }
} || pluginClasspaths.any { File(it).name.startsWith(PathUtil.KOTLIN_SCRIPTING_COMPILER_PLUGIN_NAME) }
val explicitOrLoadedScriptingPlugin = explicitScriptingPlugin ||
diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/FirKotlinToJvmBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/FirKotlinToJvmBytecodeCompiler.kt
index 605adc9..42bc2b4 100644
--- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/FirKotlinToJvmBytecodeCompiler.kt
+++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/FirKotlinToJvmBytecodeCompiler.kt
@@ -205,7 +205,9 @@
createProviderAndScopeForIncrementalCompilation = { providerAndScopeForIncrementalCompilation }
)
- val outputs = sessionsWithSources.map { (session, sources) ->
+ val outputs = sessionsWithSources.map { initializer ->
+ val session = initializer.session
+ val sources = initializer.files
buildResolveAndCheckFirFromKtFiles(session, sources, diagnosticsReporter)
}
outputs.runPlatformCheckers(diagnosticsReporter)
@@ -234,7 +236,11 @@
fir2IrActualizedResult: Fir2IrActualizedResult,
diagnosticsReporter: BaseDiagnosticsCollector,
): GenerationState {
- val (moduleFragment, components, pluginContext, irActualizedResult, _, symbolTable) = fir2IrActualizedResult
+ val moduleFragment = fir2IrActualizedResult.irModuleFragment
+ val components = fir2IrActualizedResult.components
+ val pluginContext = fir2IrActualizedResult.pluginContext
+ val irActualizedResult = fir2IrActualizedResult.irActualizedResult
+ val symbolTable = fir2IrActualizedResult.symbolTable
val irInput = ModuleCompilerIrBackendInput(
TargetId(module),
configuration,
diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt
index c2aef08..3b6a250 100644
--- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt
+++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt
@@ -77,7 +77,7 @@
val useFrontendIR = compilerConfiguration.getBoolean(CommonConfigurationKeys.USE_FIR)
val messageCollector = environment.messageCollector
- val (codegenFactory, wholeBackendInput, moduleDescriptor, bindingContext, firJvmBackendResolver, firJvmBackendExtension, mainClassFqName) = if (useFrontendIR) {
+ val initializer = if (useFrontendIR) {
// K2/PSI: base checks
val projectEnvironment =
VfsBasedProjectEnvironment(
@@ -105,6 +105,13 @@
} else {
runFrontendAndGenerateIrUsingClassicFrontend(environment, compilerConfiguration, chunk)
} ?: return true
+ val codegenFactory = initializer.codegenFactory
+ val wholeBackendInput = initializer.backendInput
+ val moduleDescriptor = initializer.moduleDescriptor
+ val bindingContext = initializer.bindingContext
+ val firJvmBackendResolver = initializer.firJvmBackendClassResolver
+ val firJvmBackendExtension = initializer.firJvmBackendExtension
+ val mainClassFqName = initializer.mainClassFqName
// K1/K2 common multi-chunk part
val localFileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.FILE_PROTOCOL)
@@ -508,13 +515,18 @@
}
for (module in chunk) {
- for ((path, packagePrefix) in module.getJavaSourceRoots()) {
+ for (initializer in module.getJavaSourceRoots()) {
+ val path = initializer.path
+ val packagePrefix = initializer.packagePrefix
addJavaSourceRoot(File(path), packagePrefix)
}
}
val isJava9Module = chunk.any { module ->
- module.getJavaSourceRoots().any { (path, packagePrefix) ->
+ module.getJavaSourceRoots().any { initializer ->
+
+ val path = initializer.path
+ val packagePrefix = initializer.packagePrefix
val file = File(path)
packagePrefix == null &&
(file.name == PsiJavaModule.MODULE_INFO_FILE ||
diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/pipeline/jvmCompilerPipeline.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/pipeline/jvmCompilerPipeline.kt
index 13d05cf..51d566b 100644
--- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/pipeline/jvmCompilerPipeline.kt
+++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/pipeline/jvmCompilerPipeline.kt
@@ -165,10 +165,14 @@
(environment.projectEnvironment as? VfsBasedProjectEnvironment)?.project?.let {
IrGenerationExtension.getInstances(it)
} ?: emptyList()
- val (moduleFragment, components, pluginContext, irActualizedResult, _, symbolTable) =
- analysisResults.convertToIrAndActualizeForJvm(
- extensions, input.configuration, environment.diagnosticsReporter, irGenerationExtensions,
- )
+ val initializer = analysisResults.convertToIrAndActualizeForJvm(
+ extensions, input.configuration, environment.diagnosticsReporter, irGenerationExtensions,
+ )
+ val moduleFragment = initializer.irModuleFragment
+ val components = initializer.components
+ val pluginContext = initializer.pluginContext
+ val irActualizedResult = initializer.irActualizedResult
+ val symbolTable = initializer.symbolTable
return ModuleCompilerIrBackendInput(
input.targetId,
@@ -314,7 +318,9 @@
val countFilesAndLines = if (performanceManager == null) null else performanceManager::addSourcesStats
- val outputs = sessionWithSources.map { (session, sources) ->
+ val outputs = sessionWithSources.map { initializer ->
+ val session = initializer.session
+ val sources = initializer.files
buildResolveAndCheckFirViaLightTree(session, sources, diagnosticsReporter, countFilesAndLines)
}
outputs.runPlatformCheckers(diagnosticsReporter)
@@ -425,11 +431,15 @@
hasKotlinSources = contentRoots.any { it is KotlinSourceRoot },
)
- val (initialRoots, javaModules) =
- classpathRootsResolver.convertClasspathRoots(contentRoots)
+ val initializer = classpathRootsResolver.convertClasspathRoots(contentRoots)
+ val initialRoots = initializer.roots
+ val javaModules = initializer.modules
val (roots, singleJavaFileRoots) =
- initialRoots.partition { (file) -> file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION }
+ initialRoots.partition { initializer ->
+ val file = initializer.file
+ file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION
+ }
// REPL and kapt2 update classpath dynamically
val rootsIndex = JvmDependenciesDynamicCompoundIndex().apply {
diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/FirMetadataSerializer.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/FirMetadataSerializer.kt
index d11a017..522ca0e 100644
--- a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/FirMetadataSerializer.kt
+++ b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/FirMetadataSerializer.kt
@@ -107,7 +107,9 @@
)
}
)
- sessionsWithSources.map { (session, files) ->
+ sessionsWithSources.map { initializer ->
+ val session = initializer.session
+ val files = initializer.files
val firFiles = session.buildFirViaLightTree(files, diagnosticsReporter, performanceManager::addSourcesStats)
resolveAndCheckFir(session, firFiles, diagnosticsReporter)
}
@@ -137,7 +139,9 @@
createProviderAndScopeForIncrementalCompilation = { providerAndScopeForIncrementalCompilation }
)
- sessionsWithSources.map { (session, files) ->
+ sessionsWithSources.map { initializer ->
+ val session = initializer.session
+ val files = initializer.files
val firFiles = session.buildFirFromKtFiles(files)
resolveAndCheckFir(session, firFiles, diagnosticsReporter)
}
@@ -161,7 +165,9 @@
val fragments = mutableMapOf<String, MutableList<ByteArray>>()
for (output in analysisResult) {
- val (session, scopeSession, fir) = output
+ val session = output.session
+ val scopeSession = output.scopeSession
+ val fir = output.fir
val languageVersionSettings = environment.configuration.languageVersionSettings
for (firFile in fir) {
diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/MetadataSerializer.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/MetadataSerializer.kt
index ea23f16..26029c6 100644
--- a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/MetadataSerializer.kt
+++ b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/MetadataSerializer.kt
@@ -50,7 +50,9 @@
val languageVersionSettings = environment.configuration.languageVersionSettings
val files = environment.getSourceFiles()
val project = environment.project
- val (module, bindingContext) = analysisResult
+ val initializer = analysisResult
+ val module = initializer.moduleDescriptor
+ val bindingContext = initializer.bindingContext
val packageTable = hashMapOf<FqName, PackageParts>()
diff --git a/compiler/container/src/org/jetbrains/kotlin/container/Storage.kt b/compiler/container/src/org/jetbrains/kotlin/container/Storage.kt
index 0bd64fc..8f53ba8 100644
--- a/compiler/container/src/org/jetbrains/kotlin/container/Storage.kt
+++ b/compiler/container/src/org/jetbrains/kotlin/container/Storage.kt
@@ -217,7 +217,8 @@
private fun injectProperties(instance: Any, context: ValueResolveContext) {
val classInfo = instance::class.java.getInfo()
- classInfo.setterInfos.forEach { (method) ->
+ classInfo.setterInfos.forEach { initializer ->
+ val method = initializer.method
val methodBinding = method.bindToMethod(containerId, context)
methodBinding.invoke(instance)
}
diff --git a/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt b/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt
index 8666898..0cd1480 100644
--- a/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt
+++ b/compiler/daemon/src/org/jetbrains/kotlin/daemon/CompileServiceImpl.kt
@@ -992,7 +992,9 @@
) {
// all others are smaller that me, take overs' clients and shut them down
log.info("$LOG_PREFIX_ASSUMING_OTHER_DAEMONS_HAVE lower prio, taking clients from them and schedule them to shutdown: my runfile: ${runFile.name} (${runFile.lastModified()}) vs best other runfile: ${bestDaemonWithMetadata.runFile.name} (${bestDaemonWithMetadata.runFile.lastModified()})")
- aliveWithOpts.forEach { (daemon, runFile, _) ->
+ aliveWithOpts.forEach { initializer ->
+ val daemon = initializer.daemon
+ val runFile = initializer.runFile
try {
daemon.getClients().takeIf { it.isGood }?.let {
it.get().forEach { clientAliveFile -> registerClient(clientAliveFile) }
diff --git a/compiler/fir/checkers/checkers.js/src/org/jetbrains/kotlin/fir/analysis/js/checkers/declaration/FirJsNameClashClassMembersChecker.kt b/compiler/fir/checkers/checkers.js/src/org/jetbrains/kotlin/fir/analysis/js/checkers/declaration/FirJsNameClashClassMembersChecker.kt
index 17b6790..8d24672 100644
--- a/compiler/fir/checkers/checkers.js/src/org/jetbrains/kotlin/fir/analysis/js/checkers/declaration/FirJsNameClashClassMembersChecker.kt
+++ b/compiler/fir/checkers/checkers.js/src/org/jetbrains/kotlin/fir/analysis/js/checkers/declaration/FirJsNameClashClassMembersChecker.kt
@@ -61,7 +61,9 @@
val symbolsToProcess = mutableListOf(startMemberWithScope)
val leaves = mutableSetOf<FirCallableSymbol<*>>()
while (symbolsToProcess.isNotEmpty()) {
- val (processingSymbol, scope) = symbolsToProcess.popLast()
+ val initializer = symbolsToProcess.popLast()
+ val processingSymbol = initializer.member
+ val scope = initializer.baseScope
val overriddenMembers = scope.getDirectOverriddenMembersWithBaseScope(processingSymbol)
for (overriddenMemberWithScope in overriddenMembers) {
if (visitedSymbols.add(overriddenMemberWithScope)) {
@@ -206,7 +208,9 @@
val fakeOverrideStableNames = stableNames.filterFakeOverrideNames(declaration, context)
val nonFakeOverrideClashes = stableNames.collectNonFakeOverrideClashes { it in fakeOverrideStableNames }
- for ((symbol, clashedWith) in nonFakeOverrideClashes) {
+ for (initializer in nonFakeOverrideClashes) {
+ val symbol = initializer.symbol
+ val clashedWith = initializer.clashedWith
val source = when (symbol) {
is FirCallableSymbol<*> -> symbol.unwrapFakeOverridesOrDelegated().source
else -> symbol.source
@@ -214,7 +218,9 @@
reporter.reportOn(source, FirJsErrors.JS_NAME_CLASH, name, clashedWith, context)
}
- fakeOverrideStableNames.findFirstFakeOverrideClash(stableNameCollector)?.let { (fakeOverrideSymbol, clashedWith) ->
+ fakeOverrideStableNames.findFirstFakeOverrideClash(stableNameCollector)?.let { initializer ->
+ val fakeOverrideSymbol = initializer.symbol
+ val clashedWith = initializer.clashedWith
reporter.reportOn(declaration.source, FirJsErrors.JS_FAKE_NAME_CLASH, name, fakeOverrideSymbol, clashedWith, context)
}
}
diff --git a/compiler/fir/checkers/checkers.native/src/org/jetbrains/kotlin/fir/analysis/native/checkers/FirNativeObjCRefinementAnnotationChecker.kt b/compiler/fir/checkers/checkers.native/src/org/jetbrains/kotlin/fir/analysis/native/checkers/FirNativeObjCRefinementAnnotationChecker.kt
index 2272293..d9dd13d 100644
--- a/compiler/fir/checkers/checkers.native/src/org/jetbrains/kotlin/fir/analysis/native/checkers/FirNativeObjCRefinementAnnotationChecker.kt
+++ b/compiler/fir/checkers/checkers.native/src/org/jetbrains/kotlin/fir/analysis/native/checkers/FirNativeObjCRefinementAnnotationChecker.kt
@@ -29,7 +29,9 @@
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
if (declaration.classKind != ClassKind.ANNOTATION_CLASS) return
val session = context.session
- val (objCAnnotation, swiftAnnotation) = declaration.annotations.findMetaAnnotations(session)
+ val initializer = declaration.annotations.findMetaAnnotations(session)
+ val objCAnnotation = initializer.hidesFromObjCAnnotation
+ val swiftAnnotation = initializer.refinesInSwiftAnnotation
if (objCAnnotation == null && swiftAnnotation == null) return
if (objCAnnotation != null && swiftAnnotation != null) {
reporter.reportOn(
diff --git a/compiler/fir/checkers/checkers.native/src/org/jetbrains/kotlin/fir/analysis/native/checkers/FirNativeObjCRefinementOverridesChecker.kt b/compiler/fir/checkers/checkers.native/src/org/jetbrains/kotlin/fir/analysis/native/checkers/FirNativeObjCRefinementOverridesChecker.kt
index d34fd8d..035dc75 100644
--- a/compiler/fir/checkers/checkers.native/src/org/jetbrains/kotlin/fir/analysis/native/checkers/FirNativeObjCRefinementOverridesChecker.kt
+++ b/compiler/fir/checkers/checkers.native/src/org/jetbrains/kotlin/fir/analysis/native/checkers/FirNativeObjCRefinementOverridesChecker.kt
@@ -74,7 +74,9 @@
var isRefinedInSwift = swiftAnnotations.isNotEmpty()
val supersNotHiddenFromObjC = mutableListOf<FirCallableSymbol<*>>()
val supersNotRefinedInSwift = mutableListOf<FirCallableSymbol<*>>()
- for ((symbol, scope) in overriddenMemberSymbols) {
+ for (initializer in overriddenMemberSymbols) {
+ val symbol = initializer.member
+ val scope = initializer.baseScope
val (superIsHiddenFromObjC, superIsRefinedInSwift) = symbol.inheritsRefinedAnnotations(context.session, scope)
if (superIsHiddenFromObjC) isHiddenFromObjC = true else supersNotHiddenFromObjC.add(symbol)
if (superIsRefinedInSwift) isRefinedInSwift = true else supersNotRefinedInSwift.add(symbol)
@@ -91,8 +93,10 @@
val (hasObjC, hasSwift) = hasRefinedAnnotations(session)
if (hasObjC && hasSwift) return true to true
// Note: `checkMember` requires all overridden symbols to be either refined or not refined.
- val (overriddenMemberSymbol, scope) = baseScope.getDirectOverriddenMembersWithBaseScope(this).firstOrNull()
+ val initializer = baseScope.getDirectOverriddenMembersWithBaseScope(this).firstOrNull()
?: return hasObjC to hasSwift
+ val overriddenMemberSymbol = initializer.member
+ val scope = initializer.baseScope
val (inheritsObjC, inheritsSwift) = overriddenMemberSymbol.inheritsRefinedAnnotations(session, scope)
return (hasObjC || inheritsObjC) to (hasSwift || inheritsSwift)
}
diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ConeTypeCompatibilityChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ConeTypeCompatibilityChecker.kt
index 583503e..b2be635 100644
--- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ConeTypeCompatibilityChecker.kt
+++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ConeTypeCompatibilityChecker.kt
@@ -162,7 +162,9 @@
var result = Compatibility.COMPATIBLE
val typeArgsCompatibility = typeArgumentMapping.asSequence()
.map { (paramRef, boundTypeArguments) ->
- val (upper, lower, compatibility) = boundTypeArguments
+ val upper = boundTypeArguments.upper
+ val lower = boundTypeArguments.lower
+ val compatibility = boundTypeArguments.compatibilityUpperBound
if (paramRef in checkedTypeParameters) {
// if we are already checking this type parameter, simply bail out to prevent infinite recursion.
Compatibility.COMPATIBLE
@@ -279,7 +281,9 @@
val queue = ArrayDeque<TypeArgumentMapping>()
queue.addLast(coneType.toTypeArgumentMapping(ctx) ?: return)
while (queue.isNotEmpty()) {
- val (typeParameterOwner, mapping) = queue.removeFirst()
+ val initializer = queue.removeFirst()
+ val typeParameterOwner = initializer.typeParameterOwner
+ val mapping = initializer.mapping
val superTypes = typeParameterOwner.getSuperTypes()
for (superType in superTypes) {
queue.addLast(superType.toTypeArgumentMapping(ctx, mapping) ?: continue)
diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirMissingDependencySupertypeUtils.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirMissingDependencySupertypeUtils.kt
index 28d7156..93106ed3 100644
--- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirMissingDependencySupertypeUtils.kt
+++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirMissingDependencySupertypeUtils.kt
@@ -32,7 +32,9 @@
if (declaration !is FirClassSymbol<*>) return false
val missingSuperTypes = context.session.missingDependencyStorage.getMissingSuperTypes(declaration)
- for ((superType, origin) in missingSuperTypes) {
+ for (initializer in missingSuperTypes) {
+ val superType = initializer.type
+ val origin = initializer.origin
val diagnostic =
if (origin == FirMissingDependencyStorage.SupertypeOrigin.TYPE_ARGUMENT && !context.languageVersionSettings.supportsFeature(
LanguageFeature.ForbidUsingSupertypesWithInaccessibleContentInTypeArguments
diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineDeclarationChecker.kt
index fa0e9fde..87b5753 100644
--- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineDeclarationChecker.kt
+++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineDeclarationChecker.kt
@@ -307,7 +307,7 @@
) {
return
}
- val (isInlineFunPublicOrPublishedApi, isCalledFunPublicOrPublishedApi, calledFunEffectiveVisibility) = checkAccessedDeclaration(
+ val initializer = checkAccessedDeclaration(
source,
accessExpression,
calledDeclaration,
@@ -315,6 +315,9 @@
context,
reporter,
)
+ val isInlineFunPublicOrPublishedApi = initializer.isInlineFunPublicOrPublishedApi
+ val isCalledFunPublicOrPublishedApi = initializer.isCalledFunPublicOrPublishedApi
+ val calledFunEffectiveVisibility = initializer.calledFunEffectiveVisibility
if (isInlineFunPublicOrPublishedApi && isCalledFunPublicOrPublishedApi) {
checkSuperCalls(calledDeclaration, accessExpression, context, reporter)
diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypesChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypesChecker.kt
index 6360858..5292094 100644
--- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypesChecker.kt
+++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirSupertypesChecker.kt
@@ -144,7 +144,8 @@
var result = false
for ((index, typeArgument) in coneType.typeArguments.withIndex()) {
if (typeArgument.isConflictingOrNotInvariant) {
- val (_, argSource) = typeRefAndSourcesForArguments.getOrNull(index) ?: continue
+ val initializer = typeRefAndSourcesForArguments.getOrNull(index) ?: continue
+ val argSource = initializer.source
reporter.reportOn(
argSource ?: superTypeRef.source,
FirErrors.PROJECTION_IN_IMMEDIATE_ARGUMENT_TO_SUPERTYPE,
diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirOptInUsageBaseChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirOptInUsageBaseChecker.kt
index d10eec8..c170239 100644
--- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirOptInUsageBaseChecker.kt
+++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirOptInUsageBaseChecker.kt
@@ -293,7 +293,11 @@
reporter: DiagnosticReporter,
source: KtSourceElement? = element.source,
) {
- for ((annotationClassId, severity, message, _, fromSupertype) in experimentalities) {
+ for (initializer in experimentalities) {
+ val annotationClassId = initializer.annotationClassId
+ val severity = initializer.severity
+ val message = initializer.message
+ val fromSupertype = initializer.fromSupertype
if (!isExperimentalityAcceptableInContext(annotationClassId, context, fromSupertype)) {
val (diagnostic, verb) = when (severity) {
Experimentality.Severity.WARNING -> FirErrors.OPT_IN_USAGE to "should"
@@ -317,7 +321,11 @@
context: CheckerContext,
reporter: DiagnosticReporter
) {
- for ((annotationClassId, severity, markerMessage, supertypeName) in experimentalities) {
+ for (initializer in experimentalities) {
+ val annotationClassId = initializer.annotationClassId
+ val severity = initializer.severity
+ val markerMessage = initializer.message
+ val supertypeName = initializer.supertypeName
if (!symbol.fir.isExperimentalityAcceptable(context.session, annotationClassId, fromSupertype = false) &&
!isExperimentalityAcceptableInContext(annotationClassId, context, fromSupertype = false)
) {
diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/AbstractDiagnosticCollectorVisitor.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/AbstractDiagnosticCollectorVisitor.kt
index 0d3343c..69b96df 100644
--- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/AbstractDiagnosticCollectorVisitor.kt
+++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/collectors/AbstractDiagnosticCollectorVisitor.kt
@@ -429,7 +429,9 @@
type: ConeKotlinType?,
block: () -> R
): R {
- val (implicitReceiverValue, implicitCompanionValues) = context.sessionHolder.collectImplicitReceivers(type, owner)
+ val initializer = context.sessionHolder.collectImplicitReceivers(type, owner)
+ val implicitReceiverValue = initializer.implicitReceiverValue
+ val implicitCompanionValues = initializer.implicitCompanionValues
val existingContext = context
implicitCompanionValues.forEach { value ->
context = context.addImplicitReceiver(null, value)
diff --git a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/backend/Fir2IrFakeOverrideStrategy.kt b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/backend/Fir2IrFakeOverrideStrategy.kt
index 20ead39..34f06e1 100644
--- a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/backend/Fir2IrFakeOverrideStrategy.kt
+++ b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/backend/Fir2IrFakeOverrideStrategy.kt
@@ -202,7 +202,11 @@
fun generateDelegatedBodies() {
for (delegatedInfo in delegatedInfos) {
- val (delegatedMember, delegateTargetFromBaseType, classSymbolOfDelegateField, delegateField, parent) = delegatedInfo
+ val delegatedMember = delegatedInfo.delegatedMember
+ val delegateTargetFromBaseType = delegatedInfo.delegateTargetFromBaseType
+ val classSymbolOfDelegateField = delegatedInfo.classSymbolOfDelegateField
+ val delegateField = delegatedInfo.delegateField
+ val parent = delegatedInfo.parent
when (delegatedMember) {
is IrSimpleFunction -> generateDelegatedFunctionBody(
delegatedMember,
@@ -338,7 +342,7 @@
parent: IrClass,
kind: Kind
) {
- val (delegateTargetFunction, substitutor, delegatingToMethodOfSupertype) = extractDelegatedFunctionBodyInfo(
+ val initializer = extractDelegatedFunctionBodyInfo(
classSymbolOfDelegateField,
delegateTargetFromBaseType,
parent,
@@ -346,6 +350,9 @@
delegatedFunction,
delegateField
)
+ val delegateTargetFunction = initializer.delegateTargetFunction
+ val substitutor = initializer.substitutor
+ val delegatingToMethodOfSupertype = initializer.delegatingToMethodOfSupertype
val offset = SYNTHETIC_OFFSET
diff --git a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/pipeline/convertToIr.kt b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/pipeline/convertToIr.kt
index d760951..3dff671 100644
--- a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/pipeline/convertToIr.kt
+++ b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/pipeline/convertToIr.kt
@@ -365,7 +365,9 @@
} catch (e: Throwable) {
CodegenUtil.reportBackendException(e, "IR fake override builder", file.fileEntry.name) { offset ->
file.fileEntry.takeIf { it.supportsDebugInfo }?.let {
- val (line, column) = it.getLineAndColumnNumbers(offset)
+ val initializer = it.getLineAndColumnNumbers(offset)
+ val line = initializer.line
+ val column = initializer.column
line to column
}
}
diff --git a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/AbstractFirDeserializedSymbolProvider.kt b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/AbstractFirDeserializedSymbolProvider.kt
index a543419..a70ee49 100644
--- a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/AbstractFirDeserializedSymbolProvider.kt
+++ b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/AbstractFirDeserializedSymbolProvider.kt
@@ -95,7 +95,7 @@
val moduleDataProvider: ModuleDataProvider,
val kotlinScopeProvider: FirKotlinScopeProvider,
val defaultDeserializationOrigin: FirDeclarationOrigin,
- private val serializerExtensionProtocol: SerializerExtensionProtocol
+ private val serializerExtensionProtocol: SerializerExtensionProtocol,
) : FirSymbolProvider(session) {
// ------------------------ Caches ------------------------
@@ -184,7 +184,7 @@
protected abstract fun extractClassMetadata(
classId: ClassId,
- parentContext: FirDeserializationContext? = null
+ parentContext: FirDeserializationContext? = null,
): ClassMetadataFindResult?
protected abstract fun isNewPlaceForBodyGeneration(classProto: ProtoBuf.Class): Boolean
@@ -193,7 +193,7 @@
sealed class ClassMetadataFindResult {
data class NoMetadata(
- val classPostProcessor: DeserializedClassPostProcessor
+ val classPostProcessor: DeserializedClassPostProcessor,
) : ClassMetadataFindResult()
data class Metadata(
@@ -223,12 +223,18 @@
private fun findAndDeserializeClass(
classId: ClassId,
- parentContext: FirDeserializationContext? = null
+ parentContext: FirDeserializationContext? = null,
): Pair<FirRegularClassSymbol?, DeserializedClassPostProcessor?> {
return when (val result = extractClassMetadata(classId, parentContext)) {
is ClassMetadataFindResult.NoMetadata -> FirRegularClassSymbol(classId) to result.classPostProcessor
is ClassMetadataFindResult.Metadata -> {
- val (nameResolver, classProto, annotationDeserializer, moduleData, sourceElement, postProcessor) = result
+ val initializer = result
+ val nameResolver = initializer.nameResolver
+ val classProto = initializer.classProto
+ val annotationDeserializer = initializer.annotationDeserializer
+ val moduleData = initializer.moduleData
+ val sourceElement = initializer.sourceElement
+ val postProcessor = initializer.classPostProcessor
moduleData ?: return null to null
val symbol = FirRegularClassSymbol(classId)
deserializeClassToSymbol(
diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrClassifierStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrClassifierStorage.kt
index 22496e1..c694538 100644
--- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrClassifierStorage.kt
+++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrClassifierStorage.kt
@@ -278,10 +278,13 @@
// ------------------------------------ local classes ------------------------------------
private fun createAndCacheLocalIrClassOnTheFly(klass: FirClass): IrClass {
- val (irClass, firClassOrLocalParent, irClassOrLocalParent) = classifiersGenerator.createLocalIrClassOnTheFly(
+ val initializer = classifiersGenerator.createLocalIrClassOnTheFly(
klass,
processMembersOfClassesOnTheFlyImmediately
)
+ val irClass = initializer.irClass
+ val firClassOrLocalParent = initializer.firClassOrLocalParent
+ val irClassOrLocalParent = initializer.irClassOrLocalParent
if (!processMembersOfClassesOnTheFlyImmediately) {
localClassesCreatedOnTheFly[firClassOrLocalParent] = irClassOrLocalParent
diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/Fir2IrDataClassMembersGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/Fir2IrDataClassMembersGenerator.kt
index e232090..7a5373c 100644
--- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/Fir2IrDataClassMembersGenerator.kt
+++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/Fir2IrDataClassMembersGenerator.kt
@@ -224,7 +224,10 @@
symbolTable: SymbolTable,
) {
for ((irClass, info) in members) {
- val (c, firClass, origin, functions) = info
+ val c = info.components
+ val firClass = info.firClass
+ val origin = info.origin
+ val functions = info.generatedFunctions
MyDataClassMethodsGenerator(c, irClass, firClass, origin, symbolTable).generateBodies(functions)
}
}
diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt
index bac21ee..fd4e353 100644
--- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt
+++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/scopes/JavaClassUseSiteMemberScope.kt
@@ -187,8 +187,10 @@
}
internal fun syntheticPropertyFromOverride(overriddenProperty: ResultOfIntersection<FirPropertySymbol>): FirSyntheticPropertySymbol? {
- val overrideInClass = overriddenProperty.overriddenMembers.firstNotNullOfOrNull superMember@{ (symbol, baseScope) ->
- // We may call this function at the STATUS phase, which means that using resolved status may lead to cycle
+ val overrideInClass = overriddenProperty.overriddenMembers.firstNotNullOfOrNull superMember@{ initializer ->
+ val symbol = initializer.member
+ val baseScope = initializer.baseScope
+// We may call this function at the STATUS phase, which means that using resolved status may lead to cycle
// So we need to use raw status here
if (!symbol.isVisibleInClass(klass.symbol, symbol.rawStatus)) return@superMember null
symbol.createOverridePropertyIfExists(declaredMemberScope, takeModalityFromGetter = true)
@@ -388,9 +390,12 @@
if (!name.sameAsBuiltinMethodWithErasedValueParameters) return false
val candidatesToOverride = supertypeScopeContext.collectIntersectionResultsForCallables(name, FirScope::processFunctionsByName)
.flatMap { it.overriddenMembers }
- .filterNot { (member, _) ->
+ .filterNot { initializer ->
+ val member = initializer.member
member.valueParameterSymbols.all { it.resolvedReturnType.lowerBoundIfFlexible().isAny }
- }.mapNotNull { (member, scope) ->
+ }.mapNotNull { initializer ->
+ val member = initializer.member
+ val scope = initializer.baseScope
BuiltinMethodsWithSpecialGenericSignature.getOverriddenBuiltinFunctionWithErasedValueParametersInJava(member, scope)
}
@@ -555,7 +560,9 @@
explicitlyDeclaredFunction: FirNamedFunctionSymbol?
): Boolean {
// E.g. contains(String) or contains(T)
- val relevantFunctionFromSupertypes = resultOfIntersection.overriddenMembers.firstOrNull { (member, scope) ->
+ val relevantFunctionFromSupertypes = resultOfIntersection.overriddenMembers.firstOrNull { initializer ->
+ val member = initializer.member
+ val scope = initializer.baseScope
BuiltinMethodsWithSpecialGenericSignature.getOverriddenBuiltinFunctionWithErasedValueParametersInJava(member, scope) != null
}?.member ?: return false
@@ -631,7 +638,8 @@
}
destination += symbolToBeCollected
directOverriddenFunctions[symbolToBeCollected] = listOf(resultOfIntersection)
- for ((member, _) in resultOfIntersection.overriddenMembers) {
+ for (initializer in resultOfIntersection.overriddenMembers) {
+ val member = initializer.member
overrideByBase[member] = symbolToBeCollected
}
return true
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/declarations/FirRetentionAnnotationHelpers.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/declarations/FirRetentionAnnotationHelpers.kt
index fe61f2b..b2cf808 100644
--- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/declarations/FirRetentionAnnotationHelpers.kt
+++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/declarations/FirRetentionAnnotationHelpers.kt
@@ -25,9 +25,11 @@
}
fun FirAnnotation.getRetention(): AnnotationRetention? {
- val (enumId, entryName) = findArgumentByName(StandardClassIds.Annotations.ParameterNames.retentionValue)
+ val initializer = findArgumentByName(StandardClassIds.Annotations.ParameterNames.retentionValue)
?.extractEnumValueArgumentInfo()
?: return null
+ val enumId = initializer.enumClassId
+ val entryName = initializer.enumEntryName
if (enumId != StandardClassIds.AnnotationRetention) {
return null
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/declarations/declarationUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/declarations/declarationUtils.kt
index 2d871f21..45caad8 100644
--- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/declarations/declarationUtils.kt
+++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/declarations/declarationUtils.kt
@@ -201,7 +201,9 @@
*/
fun Collection<MemberWithBaseScope<FirCallableSymbol<*>>>.nonSubsumed(): List<MemberWithBaseScope<FirCallableSymbol<*>>> {
val baseMembers = mutableSetOf<FirCallableSymbol<*>>()
- for ((member, scope) in this) {
+ for (initializer in this) {
+ val member = initializer.member
+ val scope = initializer.baseScope
val unwrapped = member.unwrapSubstitutionOverrides<FirCallableSymbol<*>>()
val addIfDifferent = { it: FirCallableSymbol<*> ->
val symbol = it.unwrapSubstitutionOverrides()
@@ -216,5 +218,8 @@
scope.processOverriddenProperties(member, addIfDifferent)
}
}
- return filter { (member, _) -> member.unwrapSubstitutionOverrides<FirCallableSymbol<*>>() !in baseMembers }
+ return filter { initializer ->
+ val member = initializer.member
+ member.unwrapSubstitutionOverrides<FirCallableSymbol<*>>() !in baseMembers
+ }
}
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt
index c3fcc4b9..d5ce794 100644
--- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt
+++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/Synthetics.kt
@@ -117,7 +117,9 @@
if (getter.isStatic) return
// Should have Java among overridden _and_ don't have isHiddenEverywhereBesideSuperCalls among them
- val (getterCompatibility, deprecatedOverrideOfHidden) = getterSymbol.computeGetterCompatibility()
+ val initializer = getterSymbol.computeGetterCompatibility()
+ val getterCompatibility = initializer.compatibility
+ val deprecatedOverrideOfHidden = initializer.deprecatedOverrideOfHidden
if (getterCompatibility == Incompatible) return
var getterReturnType = (getter.returnTypeRef as? FirResolvedTypeRef)?.coneType
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirUseSiteMemberScope.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirUseSiteMemberScope.kt
index fcfe69d..d624e4c 100644
--- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirUseSiteMemberScope.kt
+++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/AbstractFirUseSiteMemberScope.kt
@@ -242,14 +242,18 @@
val resultOfIntersection = callablesFromSupertypes[callableSymbol.name]
?.firstOrNull { it.chosenSymbol == callableSymbol }
?: return ProcessorAction.NONE
- for ((overridden, baseScope) in resultOfIntersection.overriddenMembers) {
+ for (initializer in resultOfIntersection.overriddenMembers) {
+ val overridden = initializer.member
+ val baseScope = initializer.baseScope
if (!processor(overridden, baseScope)) return ProcessorAction.STOP
}
return ProcessorAction.NONE
}
else -> {
for (resultOfIntersection in directOverridden) {
- for ((overridden, baseScope) in resultOfIntersection.overriddenMembers) {
+ for (initializer in resultOfIntersection.overriddenMembers) {
+ val overridden = initializer.member
+ val baseScope = initializer.baseScope
if (!processor(overridden, baseScope)) return ProcessorAction.STOP
}
}
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt
index 7ff1a70..fab6943 100644
--- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt
+++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt
@@ -128,8 +128,13 @@
val symbolForOverride = FirFakeOverrideGenerator.createSymbolForSubstitutionOverride(original, newOwnerClassId)
- val (newTypeParameters, newDispatchReceiverType, newReceiverType, newReturnType, newSubstitutor, callableCopySubstitution) =
- createSubstitutedData(member, symbolForOverride)
+ val initializer = createSubstitutedData(member, symbolForOverride)
+ val newTypeParameters = initializer.typeParameters
+ val newDispatchReceiverType = initializer.dispatchReceiverType
+ val newReceiverType = initializer.receiverType
+ val newReturnType = initializer.returnType
+ val newSubstitutor = initializer.substitutor
+ val callableCopySubstitution = initializer.deferredReturnTypeOfSubstitution
val newParameterTypes = member.valueParameters.map {
it.returnTypeRef.coneType.substitute(newSubstitutor)
}
@@ -187,8 +192,11 @@
val constructor = original.fir
val symbolForOverride = FirConstructorSymbol(original.callableId)
- val (newTypeParameters, _, _, newReturnType, newSubstitutor, callableCopySubstitution) =
- createSubstitutedData(constructor, symbolForOverride)
+ val initializer = createSubstitutedData(constructor, symbolForOverride)
+ val newTypeParameters = initializer.typeParameters
+ val newReturnType = initializer.returnType
+ val newSubstitutor = initializer.substitutor
+ val callableCopySubstitution = initializer.deferredReturnTypeOfSubstitution
// If constructor has a dispatch receiver, it should be an inner class' constructor.
// It means that we need to substitute its dispatcher as every other type,
@@ -236,8 +244,12 @@
val symbolForOverride = FirFakeOverrideGenerator.createSymbolForSubstitutionOverride(original, newOwnerClassId)
- val (newTypeParameters, newDispatchReceiverType, newReceiverType, newReturnType, _, callableCopySubstitutionForTypeUpdater) =
- createSubstitutedData(member, symbolForOverride)
+ val initializer = createSubstitutedData(member, symbolForOverride)
+ val newTypeParameters = initializer.typeParameters
+ val newDispatchReceiverType = initializer.dispatchReceiverType
+ val newReceiverType = initializer.receiverType
+ val newReturnType = initializer.returnType
+ val callableCopySubstitutionForTypeUpdater = initializer.deferredReturnTypeOfSubstitution
val newContextReceiverTypes = member.contextReceivers.map {
it.typeRef.coneType.substitute(substitutor)
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirGeneratedScopes.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirGeneratedScopes.kt
index e088070..c62b119 100644
--- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirGeneratedScopes.kt
+++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirGeneratedScopes.kt
@@ -159,16 +159,20 @@
private data class StorageContext<C>(
val generationContext: C,
- val extensionsByName: Map<Name, List<FirDeclarationGenerationExtension>>
+ val extensionsByName: Map<Name, List<FirDeclarationGenerationExtension>>,
)
private val callableStorageByClass: FirCache<FirClassSymbol<*>, CallableStorage, StorageContext<MemberGenerationContext>> =
- cachesFactory.createCache { _, (context, extensionsMap) ->
+ cachesFactory.createCache { _, initializer ->
+ val context = initializer.generationContext
+ val extensionsMap = initializer.extensionsByName
CallableStorage(cachesFactory, context, extensionsMap)
}
private val classifierStorageByClass: FirCache<FirClassSymbol<*>, ClassifierStorage, StorageContext<NestedClassGenerationContext>> =
- cachesFactory.createCache { classSymbol, (context, extensionsMap) ->
+ cachesFactory.createCache { classSymbol, initializer ->
+ val context = initializer.generationContext
+ val extensionsMap = initializer.extensionsByName
ClassifierStorage(cachesFactory, classSymbol, context, extensionsMap)
}
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirOverrideUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirOverrideUtils.kt
index c2f146b..b0bdff5 100644
--- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirOverrideUtils.kt
+++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirOverrideUtils.kt
@@ -48,7 +48,8 @@
gMember: D,
processAllOverridden: ProcessAllOverridden<D>,
): Boolean {
- val (fMember, fScope) = f
+ val fMember = f.member
+ val fScope = f.baseScope
var result = false
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt
index 0a88cc0..2a12b5c 100644
--- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt
+++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScope.kt
@@ -95,7 +95,9 @@
processor: (D, FirTypeScope) -> ProcessorAction,
processDirectOverriddenInBaseScope: FirTypeScope.(D, ((D, FirTypeScope) -> ProcessorAction)) -> ProcessorAction
): ProcessorAction {
- for ((overridden, baseScope) in getDirectOverriddenSymbols(callableSymbol)) {
+ for (initializer in getDirectOverriddenSymbols(callableSymbol)) {
+ val overridden = initializer.member
+ val baseScope = initializer.baseScope
if (overridden === callableSymbol) {
if (!baseScope.processDirectOverriddenInBaseScope(callableSymbol, processor)) return ProcessorAction.STOP
} else {
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScopeContext.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScopeContext.kt
index d28d281..4382f860 100644
--- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScopeContext.kt
+++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScopeContext.kt
@@ -187,13 +187,17 @@
},
)
} else {
- val (member, containingScope) = mostSpecific.first()
+ val initializer = mostSpecific.first()
+ val member = initializer.member
+ val containingScope = initializer.baseScope
result += ResultOfIntersection.SingleMember(member, group, containingScope)
}
}
if (allMembersWithScope.isNotEmpty()) {
- val (single, containingScope) = allMembersWithScope.single()
+ val initializer = allMembersWithScope.single()
+ val single = initializer.member
+ val containingScope = initializer.baseScope
result += ResultOfIntersection.SingleMember(single, allMembersWithScope.toList(), containingScope)
}
@@ -270,7 +274,8 @@
var hasOpen = false
var hasAbstract = false
- for ((member) in extractedOverridden) {
+ for (initializer in extractedOverridden) {
+ val member = initializer.member
when ((member.fir as FirMemberDeclaration).modality) {
Modality.FINAL -> return Modality.FINAL
Modality.SEALED -> {
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/FirMissingDependencyStorage.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/FirMissingDependencyStorage.kt
index 4dce33f..f6f18a3 100644
--- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/FirMissingDependencyStorage.kt
+++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/FirMissingDependencyStorage.kt
@@ -33,8 +33,10 @@
private fun findMissingSuperTypes(declaration: FirClassSymbol<*>): Set<TypeWithOrigin> {
return declaration.collectSuperTypes(session)
- .filterTo(mutableSetOf()) { (type, _) ->
- // Ignore types which are already errors.
+ .filterTo(mutableSetOf()) { initializer ->
+ val type = initializer.type
+
+// Ignore types which are already errors.
type !is ConeErrorType && type !is ConeDynamicType && type.lowerBoundIfFlexible().let {
it is ConeLookupTagBasedType && it.toSymbol(session) == null
}
diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt
index f73a2a0..e4b8d1b 100644
--- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt
+++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt
@@ -992,7 +992,10 @@
)
} else {
buildMultiDelegatedConstructorCall {
- classWrapper.delegatedSuperCalls.mapTo(delegatedConstructorCalls) { (delegatedSuperTypeRef, arguments, source) ->
+ classWrapper.delegatedSuperCalls.mapTo(delegatedConstructorCalls) { initializer ->
+ val delegatedSuperTypeRef = initializer.delegatedSuperTypeRef
+ val arguments = initializer.arguments
+ val source = initializer.source
createDelegatedConstructorCall(source, delegatedSuperTypeRef, arguments)
}
}
diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirExpressionBuilder.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirExpressionBuilder.kt
index 66b7d7e..cb78dfd 100644
--- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirExpressionBuilder.kt
+++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirExpressionBuilder.kt
@@ -675,7 +675,7 @@
val source = callSuffix.toFirSourceElement()
- val (calleeReference, explicitReceiver, isImplicitInvoke) = when {
+ val initializer = when {
name != null -> CalleeAndReceiver(
buildSimpleNamedReference {
this.source = callSuffix.getFirstChildExpressionUnwrapped()?.toFirSourceElement() ?: source
@@ -710,6 +710,9 @@
}
)
}
+ val calleeReference = initializer.reference
+ val explicitReceiver = initializer.receiverExpression
+ val isImplicitInvoke = initializer.isImplicitInvoke
val builder: FirQualifiedAccessExpressionBuilder = if (hasArguments) {
val builder = if (isImplicitInvoke) FirImplicitInvokeCallBuilder() else FirFunctionCallBuilder()
@@ -860,12 +863,16 @@
when (it.tokenType) {
WHEN_CONDITION_EXPRESSION -> conditions += convertWhenConditionExpression(it, whenRefWithSubject.takeIf { hasSubject })
WHEN_CONDITION_IN_RANGE -> {
- val (condition, shouldBind) = convertWhenConditionInRange(it, whenRefWithSubject, hasSubject)
+ val initializer = convertWhenConditionInRange(it, whenRefWithSubject, hasSubject)
+ val condition = initializer.expression
+ val shouldBind = initializer.shouldBindSubject
conditions += condition
shouldBindSubject = shouldBindSubject || shouldBind
}
WHEN_CONDITION_IS_PATTERN -> {
- val (condition, shouldBind) = convertWhenConditionIsPattern(it, whenRefWithSubject, hasSubject)
+ val initializer = convertWhenConditionIsPattern(it, whenRefWithSubject, hasSubject)
+ val condition = initializer.expression
+ val shouldBind = initializer.shouldBindSubject
conditions += condition
shouldBindSubject = shouldBindSubject || shouldBind
}
diff --git a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiRawFirBuilder.kt b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiRawFirBuilder.kt
index a6a5429..37b01f3 100644
--- a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiRawFirBuilder.kt
+++ b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiRawFirBuilder.kt
@@ -3037,7 +3037,10 @@
override fun visitCallExpression(expression: KtCallExpression, data: FirElement?): FirElement {
val source = expression.toFirSourceElement()
- val (calleeReference, explicitReceiver, isImplicitInvoke) = splitToCalleeAndReceiver(expression.calleeExpression, source)
+ val initializer = splitToCalleeAndReceiver(expression.calleeExpression, source)
+ val calleeReference = initializer.reference
+ val explicitReceiver = initializer.receiverExpression
+ val isImplicitInvoke = initializer.isImplicitInvoke
val result: FirQualifiedAccessExpressionBuilder =
if (expression.valueArgumentList == null && expression.lambdaArguments.isEmpty()) {
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt
index 34c0cbe..cfc0a9b 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/SamResolution.kt
@@ -109,7 +109,8 @@
private fun getFunctionTypeForPossibleSamType(type: ConeClassLikeType): ConeLookupTagBasedType? {
val firRegularClass = type.lookupTag.toRegularClassSymbol(session)?.fir ?: return null
- val (_, unsubstitutedFunctionType) = resolveFunctionTypeIfSamInterface(firRegularClass) ?: return null
+ val initializer = resolveFunctionTypeIfSamInterface(firRegularClass) ?: return null
+ val unsubstitutedFunctionType = initializer.type
val functionType = firRegularClass.buildSubstitutorWithUpperBounds(session, type)?.substituteOrNull(unsubstitutedFunctionType)
?: unsubstitutedFunctionType
@@ -133,7 +134,9 @@
fun buildSamConstructorForRegularClass(classSymbol: FirRegularClassSymbol): FirNamedFunctionSymbol? {
val firRegularClass = classSymbol.fir
- val (functionSymbol, functionType) = resolveFunctionTypeIfSamInterface(firRegularClass) ?: return null
+ val initializer = resolveFunctionTypeIfSamInterface(firRegularClass) ?: return null
+ val functionSymbol = initializer.symbol
+ val functionType = initializer.type
val syntheticFunctionSymbol = classSymbol.createSyntheticConstructorSymbol()
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConstructorProcessing.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConstructorProcessing.kt
index 979844f..4b5d533 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConstructorProcessing.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConstructorProcessing.kt
@@ -39,7 +39,9 @@
constructorFilter: ConstructorFilter,
processor: (FirCallableSymbol<*>) -> Unit
) {
- val (matchedClassifierSymbol, substitutor) = getFirstClassifierOrNull(callInfo, constructorFilter, session, bodyResolveComponents) ?: return
+ val initializer = getFirstClassifierOrNull(callInfo, constructorFilter, session, bodyResolveComponents) ?: return
+ val matchedClassifierSymbol = initializer.symbol
+ val substitutor = initializer.substitutor
val matchedClassSymbol = matchedClassifierSymbol as? FirClassLikeSymbol<*> ?: return
processConstructors(
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/stages/CheckCallableReferenceExpectedType.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/stages/CheckCallableReferenceExpectedType.kt
index 7ebf5f3..cb43e15 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/stages/CheckCallableReferenceExpectedType.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/stages/CheckCallableReferenceExpectedType.kt
@@ -208,7 +208,9 @@
// Do not adapt references against KCallable type as it's impossible to map defaults/vararg to absent parameters of KCallable
if (expectedType.isKCallableType()) return null
- val (inputTypes, returnExpectedType) = extractInputOutputTypesFromCallableReferenceExpectedType(expectedType, session) ?: return null
+ val initializer = extractInputOutputTypesFromCallableReferenceExpectedType(expectedType, session) ?: return null
+ val inputTypes = initializer.inputTypes
+ val returnExpectedType = initializer.outputType
val expectedArgumentsCount = inputTypes.size - unboundReceiverCount
if (expectedArgumentsCount < 0) return null
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/stages/ResolutionStages.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/stages/ResolutionStages.kt
index 26b391f..773ea95 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/stages/ResolutionStages.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/stages/ResolutionStages.kt
@@ -100,7 +100,9 @@
sink: CheckerSink,
context: ResolutionContext
) {
- val (atom, type) = receivers.single()
+ val initializer = receivers.single()
+ val atom = initializer.atom
+ val type = initializer.type
ArgumentCheckingProcessor.resolvePlainArgumentType(
candidate,
atom,
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt
index fba7acd..78b4114 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt
@@ -266,7 +266,9 @@
?: candidatesWithSmartcast?.values?.map { it.memberWithBaseScope }
?: error("candidatesWithoutSmartcast or candidatesWithSmartcast should be not null")
- for ((candidate, scope) in candidates) {
+ for (initializer in candidates) {
+ val candidate = initializer.member
+ val scope = initializer.baseScope
if (candidate.hasConsistentExtensionReceiver(givenExtensionReceiverOptions)) {
val dispatchReceiverToUse = candidatesWithSmartcast?.getValue(candidate)?.dispatchReceiverToUse
val isFromOriginalTypeInPresenceOfSmartCast = dispatchReceiverToUse?.unwrapSmartcast == true
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt
index 8714815..879eceae 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt
@@ -322,7 +322,9 @@
val currentLevelExits = postponedLambdaExits.pop().exits
if (currentLevelExits.isEmpty()) return
- for ((lambdas, exits) in postponedLambdaExits.all()) {
+ for (initializer in postponedLambdaExits.all()) {
+ val lambdas = initializer.lambdas
+ val exits = initializer.exits
if (symbol in lambdas) {
exits.addAll(currentLevelExits)
break
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/CompletionModeCalculator.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/CompletionModeCalculator.kt
index d1f7562..7c1ec04 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/CompletionModeCalculator.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/CompletionModeCalculator.kt
@@ -136,7 +136,8 @@
}
private fun updateDirection(directionForVariable: FixationDirectionForVariable) {
- val (variable, newDirection) = directionForVariable
+ val variable = directionForVariable.variable
+ val newDirection = directionForVariable.direction
fixationDirectionsForVariables[variable]?.let { oldDirection ->
if (oldDirection != FixationDirection.EQUALITY && oldDirection != newDirection)
fixationDirectionsForVariables[variable] = FixationDirection.EQUALITY
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt
index 9cffd9c..3080189 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt
@@ -174,7 +174,8 @@
results: ReturnArgumentsAnalysisResult,
substituteAlreadyFixedVariables: (ConeKotlinType) -> ConeKotlinType = c.createSubstituteFunctorForLambdaAnalysis(),
) {
- val (returnAtoms, additionalConstraintStorage) = results
+ val returnAtoms = results.returnArguments
+ val additionalConstraintStorage = results.additionalConstraints
val returnArguments = returnAtoms.map { it.expression }
if (additionalConstraintStorage != null) {
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt
index d6f0a65..11f8493 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt
@@ -364,7 +364,9 @@
substitutor = subCandidate.prepareCustomReturnTypeSubstitutorForFunctionCall() ?: finalSubstitutor
)
val allArgs = calleeReference.computeAllArguments(originalArgumentList)
- val (regularMapping, allArgsMapping) = subCandidate.handleVarargsAndReturnResultingArgumentsMapping(allArgs)
+ val initializer = subCandidate.handleVarargsAndReturnResultingArgumentsMapping(allArgs)
+ val regularMapping = initializer.regularMapping
+ val allArgsMapping = initializer.allArgsMapping
if (calleeReference.isError) {
result.replaceArgumentList(buildArgumentListForErrorCall(originalArgumentList, allArgsMapping))
} else {
@@ -567,10 +569,12 @@
}
}
val allArgs = calleeReference.computeAllArguments(annotationCall.argumentList, argumentMappingWithArrayOfCalls)
- val (regularMapping, allArgsMapping) = subCandidate.handleVarargsAndReturnResultingArgumentsMapping(
+ val initializer = subCandidate.handleVarargsAndReturnResultingArgumentsMapping(
allArgs,
precomputedArgumentMapping = argumentMappingWithArrayOfCalls
)
+ val regularMapping = initializer.regularMapping
+ val allArgsMapping = initializer.allArgsMapping
if (calleeReference.isError) {
annotationCall.replaceArgumentList(buildArgumentListForErrorCall(annotationCall.argumentList, allArgsMapping))
} else {
@@ -815,7 +819,9 @@
val originalArgumentList = delegatedConstructorCall.argumentList
val allArgs = calleeReference.computeAllArguments(originalArgumentList)
- val (regularMapping, allArgsMapping) = subCandidate.handleVarargsAndReturnResultingArgumentsMapping(allArgs)
+ val initializer = subCandidate.handleVarargsAndReturnResultingArgumentsMapping(allArgs)
+ val regularMapping = initializer.regularMapping
+ val allArgsMapping = initializer.allArgsMapping
if (calleeReference.isError) {
delegatedConstructorCall.replaceArgumentList(buildArgumentListForErrorCall(originalArgumentList, allArgsMapping))
} else {
@@ -972,7 +978,8 @@
val newData = expectedReturnType?.toExpectedType()
val result = transformElement(anonymousFunction, newData)
- for ((expression, _) in returnExpressions) {
+ for (initializer in returnExpressions) {
+ val expression = initializer.expression
expression.transformSingle(this, newData)
}
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirImportResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirImportResolveTransformer.kt
index a4519b3..4226eaa9 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirImportResolveTransformer.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirImportResolveTransformer.kt
@@ -68,7 +68,9 @@
get() = true
private fun transformImportForFqName(fqName: FqName, delegate: FirImport): FirImport {
- val (packageFqName, relativeClassFqName) = findLongestExistingPackage(symbolProvider, fqName)
+ val initializer = findLongestExistingPackage(symbolProvider, fqName)
+ val packageFqName = initializer.packageFqName
+ val relativeClassFqName = initializer.relativeClassFqName
return buildResolvedImport {
this.delegate = delegate
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSpecificTypeResolverTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSpecificTypeResolverTransformer.kt
index 4e35f55..3459b41 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSpecificTypeResolverTransformer.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSpecificTypeResolverTransformer.kt
@@ -89,7 +89,9 @@
withBareTypes(allowed = false) {
typeRef.transformChildren(this, data)
}
- val (resolvedType, diagnostic) = resolveType(typeRef, data, expandTypeAliases)
+ val initializer = resolveType(typeRef, data, expandTypeAliases)
+ val resolvedType = initializer.type
+ val diagnostic = initializer.diagnostic
return transformType(typeRef, resolvedType, diagnostic, data)
}
@@ -267,7 +269,9 @@
isMarkedNullable = false
source = typeRef.source
}
- val (resolvedType, diagnostic) = resolveType(typeRefToTry, data)
+ val initializer = resolveType(typeRefToTry, data)
+ val resolvedType = initializer.type
+ val diagnostic = initializer.diagnostic
if (resolvedType is ConeErrorType || diagnostic != null) continue
return buildResolvedTypeRef {
source = qualifiersToTry.last().source
diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/transformers/ImportUtils.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/transformers/ImportUtils.kt
index f661894..124926a 100644
--- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/transformers/ImportUtils.kt
+++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/transformers/ImportUtils.kt
@@ -43,7 +43,9 @@
data class PackageAndClass(val packageFqName: FqName, val relativeClassFqName: FqName?)
fun resolveToPackageOrClass(symbolProvider: FirSymbolProvider, fqName: FqName): PackageResolutionResult {
- val (currentPackage, relativeClassFqName) = findLongestExistingPackage(symbolProvider, fqName)
+ val initializer = findLongestExistingPackage(symbolProvider, fqName)
+ val currentPackage = initializer.packageFqName
+ val relativeClassFqName = initializer.relativeClassFqName
if (relativeClassFqName == null) return PackageResolutionResult.PackageOrClass(currentPackage, null, null)
val classId = ClassId(currentPackage, relativeClassFqName, isLocal = false)
diff --git a/compiler/frontend.common/src/org/jetbrains/kotlin/resolve/DefaultImportProvider.kt b/compiler/frontend.common/src/org/jetbrains/kotlin/resolve/DefaultImportProvider.kt
index e0b44f6..89af476 100644
--- a/compiler/frontend.common/src/org/jetbrains/kotlin/resolve/DefaultImportProvider.kt
+++ b/compiler/frontend.common/src/org/jetbrains/kotlin/resolve/DefaultImportProvider.kt
@@ -16,7 +16,9 @@
private data class DefaultImportsKey(val includeKotlinComparisons: Boolean, val includeLowPriorityImports: Boolean)
private val defaultImports = LockBasedStorageManager("TargetPlatform").let { storageManager ->
- storageManager.createMemoizedFunction<DefaultImportsKey, List<ImportPath>> { (includeKotlinComparisons, includeLowPriorityImports) ->
+ storageManager.createMemoizedFunction<DefaultImportsKey, List<ImportPath>> { initializer ->
+ val includeKotlinComparisons = initializer.includeKotlinComparisons
+ val includeLowPriorityImports = initializer.includeLowPriorityImports
ArrayList<ImportPath>().apply {
listOf(
"kotlin.*",
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/incremental/IncrementalPackageFragmentProvider.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/incremental/IncrementalPackageFragmentProvider.kt
index 606c2be..723cf90 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/incremental/IncrementalPackageFragmentProvider.kt
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/incremental/IncrementalPackageFragmentProvider.kt
@@ -90,7 +90,9 @@
ChainedMemberScope.create(
"Member scope for incremental compilation: union of multifile class parts data for $facadeName",
partsInternalNames.mapNotNull { internalName ->
- incrementalCache.getPackagePartData(internalName)?.let { (data, strings) ->
+ incrementalCache.getPackagePartData(internalName)?.let { initializer ->
+ val data = initializer.data
+ val strings = initializer.strings
val (nameResolver, packageProto) = JvmProtoBufUtil.readPackageDataFrom(data, strings)
val partName = JvmClassName.byInternalName(internalName)
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmResolverForModuleFactory.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmResolverForModuleFactory.kt
index 25395b9..07794cbf 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmResolverForModuleFactory.kt
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmResolverForModuleFactory.kt
@@ -67,7 +67,10 @@
resolveOptimizingOptions: OptimizingOptions?,
absentDescriptorHandlerClass: Class<out AbsentDescriptorHandler>?
): ResolverForModule {
- val (moduleInfo, syntheticFiles, moduleContentScope) = moduleContent
+ val initializer = moduleContent
+ val moduleInfo = initializer.moduleInfo
+ val syntheticFiles = initializer.syntheticFiles
+ val moduleContentScope = initializer.moduleContentScope
val project = moduleContext.project
val declarationProviderFactory = DeclarationProviderFactoryService.createDeclarationProviderFactory(
project, moduleContext.storageManager, syntheticFiles,
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/RepeatableAnnotationChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/RepeatableAnnotationChecker.kt
index 65e8e12..01608e0 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/RepeatableAnnotationChecker.kt
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/RepeatableAnnotationChecker.kt
@@ -120,7 +120,10 @@
private fun checkRepeatedEntries(annotations: List<ResolvedAnnotation>, trace: BindingTrace) {
val entryTypesWithAnnotations = hashMapOf<FqName, MutableList<AnnotationUseSiteTarget?>>()
- for ((entry, descriptor, useSiteTarget) in annotations) {
+ for (initializer in annotations) {
+ val entry = initializer.entry
+ val descriptor = initializer.descriptor
+ val useSiteTarget = initializer.useSiteTarget
val fqName = descriptor.fqName ?: continue
val classDescriptor = descriptor.annotationClass ?: continue
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/modules/JavaModule.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/modules/JavaModule.kt
index 6e0f3cd..779dcb5 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/modules/JavaModule.kt
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/modules/JavaModule.kt
@@ -93,13 +93,17 @@
get() = moduleInfoFile.extension == JavaFileType.DEFAULT_EXTENSION || moduleInfoFile.fileType == JavaFileType.INSTANCE
override fun exports(packageFqName: FqName): Boolean {
- return moduleInfo.exports.any { (fqName, toModules) ->
+ return moduleInfo.exports.any { initializer ->
+ val fqName = initializer.packageFqName
+ val toModules = initializer.toModules
fqName == packageFqName && toModules.isEmpty()
}
}
override fun exportsTo(packageFqName: FqName, moduleName: String): Boolean {
- return moduleInfo.exports.any { (fqName, toModules) ->
+ return moduleInfo.exports.any { initializer ->
+ val fqName = initializer.packageFqName
+ val toModules = initializer.toModules
fqName == packageFqName && (toModules.isEmpty() || moduleName in toModules)
}
}
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/multiplatform/OptionalAnnotationPackageFragmentProvider.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/multiplatform/OptionalAnnotationPackageFragmentProvider.kt
index d28e8ec..2a404f9 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/multiplatform/OptionalAnnotationPackageFragmentProvider.kt
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/multiplatform/OptionalAnnotationPackageFragmentProvider.kt
@@ -97,7 +97,11 @@
}
private class OptionalAnnotationClassDataFinder(classes: List<ClassData>) : ClassDataFinder {
- val classIdToData = classes.associateBy { (nameResolver, klass) -> nameResolver.getClassId(klass.fqName) }
+ val classIdToData = classes.associateBy { initializer ->
+ val nameResolver = initializer.nameResolver
+ val klass = initializer.classProto
+ nameResolver.getClassId(klass.fqName)
+ }
override fun findClassData(classId: ClassId): ClassData? = classIdToData[classId]
}
diff --git a/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProviderImpl.kt b/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProviderImpl.kt
index f742935..a276edd 100644
--- a/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProviderImpl.kt
+++ b/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProviderImpl.kt
@@ -248,7 +248,9 @@
if (!function.hasBody()) return
- val (returnedExpressions, hasReturnsInInlinedLambdas) = collectReturnExpressions()
+ val initializer = collectReturnExpressions()
+ val returnedExpressions = initializer.returnedExpressions
+ val hasReturnsInInlinedLambdas = initializer.hasReturnsInInlinedLambda
val blockBody = function.hasBlockBody()
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/analyzer/common/CommonResolverForModuleFactory.kt b/compiler/frontend/src/org/jetbrains/kotlin/analyzer/common/CommonResolverForModuleFactory.kt
index 8b292a4..47a28ee 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/analyzer/common/CommonResolverForModuleFactory.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/analyzer/common/CommonResolverForModuleFactory.kt
@@ -95,7 +95,9 @@
resolveOptimizingOptions: OptimizingOptions?,
absentDescriptorHandlerClass: Class<out AbsentDescriptorHandler>?
): ResolverForModule {
- val (moduleInfo, syntheticFiles, moduleContentScope) = moduleContent
+ val moduleInfo = moduleContent.moduleInfo
+ val syntheticFiles = moduleContent.syntheticFiles
+ val moduleContentScope = moduleContent.moduleContentScope
val project = moduleContext.project
val declarationProviderFactory = DeclarationProviderFactoryService.createDeclarationProviderFactory(
project, moduleContext.storageManager, syntheticFiles,
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/CheckerTestUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/CheckerTestUtil.kt
index 0de61cc..2ad4a20 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/CheckerTestUtil.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/CheckerTestUtil.kt
@@ -625,7 +625,10 @@
}
}
- for ((diagnostic, start, end) in uncheckedDiagnostics) {
+ for (initializer in uncheckedDiagnostics) {
+ val diagnostic = initializer.diagnostic
+ val start = initializer.start
+ val end = initializer.end
val range = TextRange(start, end)
diagnosticsGroupedByRanges.put(range, diagnostic)
}
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/descriptors/annotations/AnnotationSplitter.kt b/compiler/frontend/src/org/jetbrains/kotlin/descriptors/annotations/AnnotationSplitter.kt
index d7aad7c..9615942 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/descriptors/annotations/AnnotationSplitter.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/descriptors/annotations/AnnotationSplitter.kt
@@ -66,7 +66,9 @@
other.add(annotation)
}
- for ((annotation, target) in @Suppress("DEPRECATION") allAnnotations.getUseSiteTargetedAnnotations()) {
+ for (initializer in @Suppress("DEPRECATION") allAnnotations.getUseSiteTargetedAnnotations()) {
+ val annotation = initializer.annotation
+ val target = initializer.target
if (target in applicableTargets) {
map.getOrPut(target) { arrayListOf() }.add(annotation)
}
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/AnnotationsWhitelistDescriptorRenderer.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/AnnotationsWhitelistDescriptorRenderer.kt
index 2c59f3f..625f5ae 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/AnnotationsWhitelistDescriptorRenderer.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/AnnotationsWhitelistDescriptorRenderer.kt
@@ -22,7 +22,8 @@
private val toParameterRenderer: DescriptorRenderer.() -> DiagnosticParameterRenderer<DeclarationDescriptor>
) : DiagnosticParameterRenderer<DeclarationWithDiagnosticComponents> {
override fun render(obj: DeclarationWithDiagnosticComponents, renderingContext: RenderingContext): String {
- val (descriptor, diagnosticComponents) = obj
+ val descriptor = obj.declaration
+ val diagnosticComponents = obj.diagnosticComponents
return baseRenderer.withOptions {
annotationFilter = { annotation ->
diagnosticComponents.isNullabilityAnnotation(annotation, descriptor)
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt
index da0dec3..6d2b8b5 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt
@@ -68,7 +68,9 @@
reportOn: KtExpression?,
trace: BindingTrace
): ClassifierDescriptor? {
- val (classifier, isDeprecated) = findFirstClassifierWithDeprecationStatus(name, lookupLocation) ?: return null
+ val initializer = findFirstClassifierWithDeprecationStatus(name, lookupLocation) ?: return null
+ val classifier = initializer.descriptor
+ val isDeprecated = initializer.isDeprecated
if (isDeprecated && reportOn != null) {
trace.record(BindingContext.DEPRECATED_SHORT_NAME_ACCESS, reportOn) // For IDE
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt
index 56743e4..99e12ca 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallCompleter.kt
@@ -406,7 +406,10 @@
context: BasicCallResolutionContext
): OverloadResolutionResultsImpl<*>? {
val cachedData = getResolutionResultsCachedData(expression, context) ?: return null
- val (cachedResolutionResults, cachedContext, tracing) = cachedData
+ val initializer = cachedData
+ val cachedResolutionResults = initializer.resolutionResults
+ val cachedContext = initializer.deferredComputation
+ val tracing = initializer.tracing
val contextForArgument = cachedContext.replaceBindingTrace(context.trace)
.replaceExpectedType(context.expectedType).replaceCollectAllCandidates(false).replaceCallPosition(context.callPosition)
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/DslScopeViolationCallChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/DslScopeViolationCallChecker.kt
index 223ccf3..d876a13 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/DslScopeViolationCallChecker.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/DslScopeViolationCallChecker.kt
@@ -57,13 +57,16 @@
if (receiversUntilOneFromTheCall.isEmpty()) return
- val (callDslMarkers, additionalCallDslMarkers) = extractDslMarkerFqNames(callImplicitReceiver)
+ val initializer = extractDslMarkerFqNames(callImplicitReceiver)
+ val callDslMarkers = initializer.common
+ val additionalCallDslMarkers = initializer.fromContainingFunctionType
if (callDslMarkers.isEmpty() && additionalCallDslMarkers.isEmpty()) return
val dslMarkersFromOuterReceivers = receiversUntilOneFromTheCall.map(::extractDslMarkerFqNames)
val closestAnotherReceiverWithSameDslMarker =
- dslMarkersFromOuterReceivers.firstOrNull { (dslMarkersFromReceiver, _) ->
+ dslMarkersFromOuterReceivers.firstOrNull { initializer ->
+ val dslMarkersFromReceiver = initializer.common
dslMarkersFromReceiver.any(callDslMarkers::contains)
}
@@ -76,7 +79,9 @@
val allDslMarkersFromCall = callDslMarkers + additionalCallDslMarkers
val closestAnotherReceiverWithSameDslMarkerWithDeprecation =
- dslMarkersFromOuterReceivers.firstOrNull { (dslMarkersFromReceiver, additionalDslMarkersFromReceiver) ->
+ dslMarkersFromOuterReceivers.firstOrNull { initializer ->
+ val dslMarkersFromReceiver = initializer.common
+ val additionalDslMarkersFromReceiver = initializer.fromContainingFunctionType
val allMarkersFromReceiver = dslMarkersFromReceiver + additionalDslMarkersFromReceiver
allDslMarkersFromCall.any(allMarkersFromReceiver::contains)
}
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt
index b3ddb44..13a3297 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt
@@ -161,7 +161,11 @@
}
fun KotlinType.substitute(): KotlinType? = substitutor.substitute(this, Variance.INVARIANT)
- return initialConstraints.all { (kind, subtype, superType, position) ->
+ return initialConstraints.all { initializer ->
+ val kind = initializer.kind
+ val subtype = initializer.subtype
+ val superType = initializer.superType
+ val position = initializer.position
val resultSubType = subtype.substitute()?.let {
// the call might be done via safe access, so we check for notNullable receiver type;
// 'unsafe call' error is reported otherwise later
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowValueKindUtils.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowValueKindUtils.kt
index e1d895a..9c138e0 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowValueKindUtils.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DataFlowValueKindUtils.kt
@@ -130,9 +130,10 @@
fun hasNoWritersInClosures(
variableContainingDeclaration: DeclarationDescriptor,
writers: Set<AssignedVariablesSearcher.Writer>,
- bindingContext: BindingContext
+ bindingContext: BindingContext,
): Boolean {
- return writers.none { (_, writerDeclaration) ->
+ return writers.none { initializer ->
+ val writerDeclaration = initializer.declaration
writerDeclaration != null &&
variableContainingDeclaration != writerDeclaration.getDeclarationDescriptorIncludingConstructors(bindingContext)
}
@@ -143,7 +144,10 @@
accessElement: KtElement
): Boolean {
val parent = accessElement.getElementParentDeclaration() ?: return false
- return writers.none { (assignment) -> !assignment.before(parent) }
+ return writers.none { initializer ->
+ val assignment = initializer.assignment
+ !assignment.before(parent)
+ }
}
private fun isAccessedBeforeAllClosureWriters(
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt
index 18016c3..d847e16 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt
@@ -234,7 +234,9 @@
tracingStrategy: TracingStrategy
): OverloadResolutionResults<D> {
if (result is AllCandidatesResolutionResult) {
- val resolvedCalls = result.allCandidates.map { (candidate, diagnostics) ->
+ val resolvedCalls = result.allCandidates.map { initializer ->
+ val candidate = initializer.candidate
+ val diagnostics = initializer.diagnostics
val system = candidate.getSystem()
val resultingSubstitutor =
system.asReadOnlyStorage().buildResultingSubstitutor(system as TypeSystemInferenceExtensionContext)
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/OptInUsageChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/OptInUsageChecker.kt
index fef2384..7abc54f 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/OptInUsageChecker.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/OptInUsageChecker.kt
@@ -99,7 +99,9 @@
// KT-47708 special case (warning only)
val methodDescriptor = resultingDescriptor.getSingleAbstractMethod()
val samOptIns = methodDescriptor.loadOptIns(bindingContext, languageVersionSettings)
- .map { (fqName, _, message) ->
+ .map { initializer ->
+ val fqName = initializer.annotationFqName
+ val message = initializer.message
OptInDescription(fqName, OptInDescription.Severity.WARNING, message, subclassesOnly = false)
}
reportNotAllowedOptIns(samOptIns, reportOn, context)
@@ -159,7 +161,11 @@
trace: BindingTrace,
diagnostics: OptInReporterMultiplexer
) {
- for ((annotationFqName, severity, message, subclassesOnly) in descriptions) {
+ for (initializer in descriptions) {
+ val annotationFqName = initializer.annotationFqName
+ val severity = initializer.severity
+ val message = initializer.message
+ val subclassesOnly = initializer.subclassesOnly
if (!element.isOptInAllowed(annotationFqName, languageVersionSettings, trace.bindingContext, subclassesOnly)) {
val diagnostic = when (severity) {
OptInDescription.Severity.WARNING -> diagnostics.warning
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/FileScopeFactory.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/FileScopeFactory.kt
index dac4fc3..eb29e09 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/FileScopeFactory.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/FileScopeFactory.kt
@@ -193,8 +193,10 @@
}
fun createImportingScope(): LazyImportScope {
- val (defaultExplicitImportResolver, defaultAllUnderImportResolver, defaultLowPriorityImportResolver) =
- createDefaultImportResolversForFile()
+ val initializer = createDefaultImportResolversForFile()
+ val defaultExplicitImportResolver = initializer.explicit
+ val defaultAllUnderImportResolver = initializer.allUnder
+ val defaultLowPriorityImportResolver = initializer.lowPriority
val dummyContainerDescriptor = DummyContainerDescriptor(file, packageFragment)
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt
index c7d29c1..e79e484 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/DoubleColonExpressionResolver.kt
@@ -354,8 +354,10 @@
}
}
- val (isReservedExpressionSyntax, doubleColonLHS, traceAndCacheFromReservedDoubleColonLHS) =
- resolveReservedExpressionSyntaxOnDoubleColonLHS(doubleColonExpression, c)
+ val initializer = resolveReservedExpressionSyntaxOnDoubleColonLHS(doubleColonExpression, c)
+ val isReservedExpressionSyntax = initializer.isReservedExpressionSyntax
+ val doubleColonLHS = initializer.lhs
+ val traceAndCacheFromReservedDoubleColonLHS = initializer.traceAndCache
if (isReservedExpressionSyntax) return doubleColonLHS
diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/BuildDiffsStorage.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/BuildDiffsStorage.kt
index 25858a5..b9225fe 100644
--- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/BuildDiffsStorage.kt
+++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/BuildDiffsStorage.kt
@@ -139,7 +139,9 @@
fun ObjectOutputStream.writeLookups(lookupSymbols: Collection<LookupSymbol>) {
writeInt(lookupSymbols.size)
- for ((name, scope) in lookupSymbols) {
+ for (initializer in lookupSymbols) {
+ val name = initializer.name
+ val scope = initializer.scope
writeUTF(name)
writeUTF(scope)
}
diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCompilerRunner.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCompilerRunner.kt
index 5ed8ddb..6b5a740 100644
--- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCompilerRunner.kt
+++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalCompilerRunner.kt
@@ -552,10 +552,13 @@
break
}
- val (dirtyLookupSymbols, dirtyClassFqNames, forceRecompile) = changesCollector.getChangedAndImpactedSymbols(
+ val initializer = changesCollector.getChangedAndImpactedSymbols(
listOf(caches.platformCache),
reporter
)
+ val dirtyLookupSymbols = initializer.dirtyLookupSymbols
+ val dirtyClassFqNames = initializer.dirtyClassesFqNames
+ val forceRecompile = initializer.dirtyClassesFqNamesForceRecompile
val compiledInThisIterationSet = sourcesToCompile.toHashSet()
val forceToRecompileFiles = mapClassesFqNamesToFiles(listOf(caches.platformCache), forceRecompile, reporter)
diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalFirJvmCompilerRunner.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalFirJvmCompilerRunner.kt
index bad26be..28cd1d1 100644
--- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalFirJvmCompilerRunner.kt
+++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalFirJvmCompilerRunner.kt
@@ -260,9 +260,14 @@
val extensions = JvmFir2IrExtensions(configuration, JvmIrDeserializerImpl())
val irGenerationExtensions = projectEnvironment.project.let { IrGenerationExtension.getInstances(it) }
- val (irModuleFragment, components, pluginContext, irActualizedResult, _, symbolTable) = cycleResult.convertToIrAndActualizeForJvm(
+ val initializer = cycleResult.convertToIrAndActualizeForJvm(
extensions, configuration, compilerEnvironment.diagnosticsReporter, irGenerationExtensions,
)
+ val irModuleFragment = initializer.irModuleFragment
+ val components = initializer.components
+ val pluginContext = initializer.pluginContext
+ val irActualizedResult = initializer.irActualizedResult
+ val symbolTable = initializer.symbolTable
val irInput = ModuleCompilerIrBackendInput(
targetId,
diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJsCompilerRunner.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJsCompilerRunner.kt
index 9d2cccd..567ee88 100644
--- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJsCompilerRunner.kt
+++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJsCompilerRunner.kt
@@ -248,8 +248,9 @@
val changesCollector = ChangesCollector()
// todo: split compare and update (or cache comparing)
caches.platformCache.compare(translatedFiles, changesCollector)
- val (dirtyLookupSymbols, dirtyClassFqNames) =
- changesCollector.getChangedAndImpactedSymbols(listOf(caches.platformCache), reporter)
+ val initializer = changesCollector.getChangedAndImpactedSymbols(listOf(caches.platformCache), reporter)
+ val dirtyLookupSymbols = initializer.dirtyLookupSymbols
+ val dirtyClassFqNames = initializer.dirtyClassesFqNames
// todo unify with main cycle
newDirtySources.addAll(mapLookupSymbolsToFiles(caches.lookupCache, dirtyLookupSymbols, reporter, excludes = sourcesToCompile))
newDirtySources.addAll(
diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/incrementalFirCacheUtils.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/incrementalFirCacheUtils.kt
index 710a99c..42c7908 100644
--- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/incrementalFirCacheUtils.kt
+++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/incrementalFirCacheUtils.kt
@@ -133,8 +133,10 @@
visitFirFiles(output)
}
- val (dirtyLookupSymbols, dirtyClassFqNames, forceRecompile) =
- changesCollector.getChangedAndImpactedSymbols(listOf(caches.platformCache), reporter)
+ val initializer = changesCollector.getChangedAndImpactedSymbols(listOf(caches.platformCache), reporter)
+ val dirtyLookupSymbols = initializer.dirtyLookupSymbols
+ val dirtyClassFqNames = initializer.dirtyClassesFqNames
+ val forceRecompile = initializer.dirtyClassesFqNamesForceRecompile
val forceToRecompileFiles = mapClassesFqNamesToFiles(listOf(caches.platformCache), forceRecompile, reporter)
diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/ExpectSymbolTransformer.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/ExpectSymbolTransformer.kt
index dae1452..18fb880 100644
--- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/ExpectSymbolTransformer.kt
+++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/ExpectSymbolTransformer.kt
@@ -83,7 +83,10 @@
super.visitPropertyReference(expression)
if (!isTargetDeclaration(expression.symbol.owner)) return
- val (newSymbol, newGetter, newSetter) = getActualProperty(expression.symbol.descriptor) ?: return
+ val initializer = getActualProperty(expression.symbol.descriptor) ?: return
+ val newSymbol = initializer.propertySymbol
+ val newGetter = initializer.getterSymbol
+ val newSetter = initializer.setterSymbol
expression.symbol = newSymbol
expression.getter = newGetter
expression.setter = newSetter
diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/AbstractSuspendFunctionsLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/AbstractSuspendFunctionsLowering.kt
index 96c0d60..254df46 100644
--- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/AbstractSuspendFunctionsLowering.kt
+++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/AbstractSuspendFunctionsLowering.kt
@@ -63,7 +63,9 @@
val function = (element as? IrSimpleFunction) ?: return null
if (!function.isSuspend || function.modality == Modality.ABSTRACT) return null
- val (tailSuspendCalls, hasNotTailSuspendCalls) = collectTailSuspendCalls(context, function)
+ val initializer = collectTailSuspendCalls(context, function)
+ val tailSuspendCalls = initializer.callSites
+ val hasNotTailSuspendCalls = initializer.hasNotTailSuspendCalls
return if (hasNotTailSuspendCalls) {
listOf<IrDeclaration>(buildCoroutine(function).clazz, function)
} else {
diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalClassPopupLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalClassPopupLowering.kt
index a24e1b0..2887a78 100644
--- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalClassPopupLowering.kt
+++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalClassPopupLowering.kt
@@ -61,7 +61,10 @@
}
}, null)
- for ((local, newContainer, extractedUnder) in extractedLocalClasses) {
+ for (initializer in extractedLocalClasses) {
+ val local = initializer.local
+ val newContainer = initializer.newContainer
+ val extractedUnder = initializer.extractedUnder
when (newContainer) {
is IrStatementContainer -> {
val insertIndex = extractedUnder?.let { newContainer.statements.indexOf(it) } ?: -1
diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt
index cce3138..0a77cfc 100644
--- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt
+++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt
@@ -720,7 +720,9 @@
val newName = generateNameForLiftedDeclaration(oldDeclaration, ownerParent)
// TODO: consider using fields to access the closure of enclosing class.
- val (capturedValues, capturedTypeParameters) = localFunctionContext.closure
+ val initializer = localFunctionContext.closure
+ val capturedValues = initializer.capturedValues
+ val capturedTypeParameters = initializer.capturedTypeParameters
val newDeclaration = context.irFactory.buildFun {
updateFrom(oldDeclaration)
diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/TailrecLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/TailrecLowering.kt
index 459457c..f1eeb70 100644
--- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/TailrecLowering.kt
+++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/TailrecLowering.kt
@@ -74,7 +74,9 @@
}
private fun TailrecLowering.lowerTailRecursionCalls(irFunction: IrFunction) {
- val (tailRecursionCalls, someCallsAreFromOtherFunctions) = collectTailRecursionCalls(irFunction, ::followFunctionReference)
+ val initializer = collectTailRecursionCalls(irFunction, ::followFunctionReference)
+ val tailRecursionCalls = initializer.ir
+ val someCallsAreFromOtherFunctions = initializer.fromManyFunctions
if (tailRecursionCalls.isEmpty()) {
return
}
diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ForLoopsLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ForLoopsLowering.kt
index d733bf9..1c2e8bc 100644
--- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ForLoopsLowering.kt
+++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ForLoopsLowering.kt
@@ -187,8 +187,10 @@
val loweredHeader = lowerHeader(iteratorVariable, loopHeader)
- val (newLoop, loopReplacementExpression) = lowerWhileLoop(oldLoop, loopHeader)
- ?: return super.visitBlock(expression) // Cannot lower the loop.
+ val initializer = lowerWhileLoop(oldLoop, loopHeader)
+ ?: return super.visitBlock(expression)
+ val newLoop = initializer.newLoop
+ val loopReplacementExpression = initializer.replacementExpression
// We can lower both the header and while loop.
// Update mapping from old to new loop so we can later update references in break/continue.
@@ -220,8 +222,11 @@
private fun lowerWhileLoop(loop: IrWhileLoop, loopHeader: ForLoopHeader): LoopReplacement? {
val loopBodyStatements = (loop.body as? IrContainerExpression)?.statements ?: return null
- val (mainLoopVariable, mainLoopVariableIndex, loopVariableComponents, loopVariableComponentIndices) =
- gatherLoopVariableInfo(loopBodyStatements)
+ val initializer2 = gatherLoopVariableInfo(loopBodyStatements)
+ val mainLoopVariable = initializer2.mainLoopVariable
+ val mainLoopVariableIndex = initializer2.mainLoopVariableIndex
+ val loopVariableComponents = initializer2.loopVariableComponents
+ val loopVariableComponentIndices = initializer2.loopVariableComponentIndices
if (loopHeader.consumesLoopVariableComponents && mainLoopVariable.origin != IrDeclarationOrigin.IR_TEMPORARY_VARIABLE) {
// We determine if there is a destructuring declaration by checking if the main loop variable is temporary.
diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/phaser/performByIrFile.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/phaser/performByIrFile.kt
index 17f887d..39342d3 100644
--- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/phaser/performByIrFile.kt
+++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/phaser/performByIrFile.kt
@@ -65,7 +65,9 @@
} catch (e: Throwable) {
CodegenUtil.reportBackendException(e, "IR lowering", irFile.fileEntry.name) { offset ->
irFile.fileEntry.takeIf { it.supportsDebugInfo }?.let {
- val (line, column) = it.getLineAndColumnNumbers(offset)
+ val initializer = it.getLineAndColumnNumbers(offset)
+ val line = initializer.line
+ val column = initializer.column
line to column
}
}
@@ -115,7 +117,9 @@
thrownFromThread.get()?.let { (e, irFile) ->
CodegenUtil.reportBackendException(e, "Experimental parallel IR backend", irFile.fileEntry.name) { offset ->
irFile.fileEntry.takeIf { it.supportsDebugInfo }?.let {
- val (line, column) = it.getLineAndColumnNumbers(offset)
+ val initializer = it.getLineAndColumnNumbers(offset)
+ val line = initializer.line
+ val column = initializer.column
line to column
}
}
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/CacheUpdater.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/CacheUpdater.kt
index e69dfb3..660ca69 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/CacheUpdater.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/CacheUpdater.kt
@@ -209,7 +209,11 @@
val removedFilesMetadata = hashMapOf<KotlinLibraryFile, Map<KotlinSourceFile, KotlinSourceFileMetadata>>()
fun collectDirtyFiles(lib: KotlinLibraryFile, cache: IncrementalCache): MutableMap<KotlinSourceFile, KotlinSourceFileMetadata> {
- val (addedFiles, removedFiles, modifiedFiles, nonModifiedFiles) = cache.collectModifiedFiles()
+ val initializer = cache.collectModifiedFiles()
+ val addedFiles = initializer.addedFiles
+ val removedFiles = initializer.removedFiles
+ val modifiedFiles = initializer.modifiedFiles
+ val nonModifiedFiles = initializer.nonModifiedFiles
val fileStats by lazy(LazyThreadSafetyMode.NONE) { dirtyFileStats.getOrPutFiles(lib) }
addedFiles.forEach { fileStats.addDirtFileStat(it, DirtyFileState.ADDED_FILE) }
@@ -766,7 +770,11 @@
)
private fun loadIrAndMakeIrFragmentGenerators(): FragmentGenerators {
- val (incrementalCachesArtifacts, loadedIr, dirtyFiles, irCompiler) = loadIrForDirtyFilesAndInitCompiler()
+ val initializer = loadIrForDirtyFilesAndInitCompiler()
+ val incrementalCachesArtifacts = initializer.incrementalCacheArtifacts
+ val loadedIr = initializer.loadedIr
+ val dirtyFiles = initializer.dirtyFiles
+ val irCompiler = initializer.irCompiler
val moduleNames = loadedIr.loadedFragments.entries.associate { it.key to it.value.name.asString() }
@@ -802,7 +810,10 @@
stopwatch.clear()
dirtyFileStats.clear()
- val (incrementalCachesArtifacts, moduleNames, generators) = loadIrAndMakeIrFragmentGenerators()
+ val initializer = loadIrAndMakeIrFragmentGenerators()
+ val incrementalCachesArtifacts = initializer.incrementalCacheArtifacts
+ val moduleNames = initializer.moduleNames
+ val generators = initializer.generators
val rebuiltFragments = generateIrFragments(generators)
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/IdSignatureHashCalculator.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/IdSignatureHashCalculator.kt
index 2bccb96..be549a9 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/IdSignatureHashCalculator.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/IdSignatureHashCalculator.kt
@@ -118,7 +118,9 @@
val newDependsStack = transitiveDepends.toMutableList()
while (newDependsStack.isNotEmpty()) {
- val (usedInlineFunctions, usedConstants) = newDependsStack.removeLast().inlineDepends
+ val initializer = newDependsStack.removeLast().inlineDepends
+ val usedInlineFunctions = initializer.usedInlineFunctions
+ val usedConstants = initializer.usedConstants
for (inlineFunction in usedInlineFunctions) {
if (transitiveDepends.add(inlineFunction)) {
newDependsStack += inlineFunction
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/JsPerFileCache.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/JsPerFileCache.kt
index 0ef5382..0862cf3 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/JsPerFileCache.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/JsPerFileCache.kt
@@ -230,7 +230,10 @@
val importWithEffectIn = ifTrue { readString() }
- val (definitions, nameBindings, optionalCrossModuleImports) = fetchJsIrModuleHeaderNames()
+ val initializer = fetchJsIrModuleHeaderNames()
+ val definitions = initializer.definitions
+ val nameBindings = initializer.nameBindings
+ val optionalCrossModuleImports = initializer.optionalCrossModuleImports
it.jsIrHeader = JsIrModuleHeader(
moduleName = moduleName,
@@ -384,13 +387,19 @@
}
override fun fetchCompiledJsCode(cacheInfo: CachedFileInfo) =
- cacheInfo.cachedFiles?.let { (jsCodeFile, sourceMapFile, tsDeclarationsFile) ->
+ cacheInfo.cachedFiles?.let { initializer ->
+ val jsCodeFile = initializer.jsCodeFile
+ val sourceMapFile = initializer.sourceMapFile
+ val tsDeclarationsFile = initializer.tsDeclarationsFile
jsCodeFile.ifExists { this }
?.let { CompilationOutputsCached(it, sourceMapFile?.ifExists { this }, tsDeclarationsFile?.ifExists { this }) }
}
override fun commitCompiledJsCode(cacheInfo: CachedFileInfo, compilationOutputs: CompilationOutputsBuilt) =
- cacheInfo.cachedFiles?.let { (jsCodeFile, jsMapFile, tsDeclarationsFile) ->
+ cacheInfo.cachedFiles?.let { initializer ->
+ val jsCodeFile = initializer.jsCodeFile
+ val jsMapFile = initializer.sourceMapFile
+ val tsDeclarationsFile = initializer.tsDeclarationsFile
tsDeclarationsFile?.writeIfNotNull(compilationOutputs.tsDefinitions?.raw)
compilationOutputs.writeJsCodeIntoModuleCache(jsCodeFile, jsMapFile)
} ?: compilationOutputs
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/JsPerModuleCache.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/JsPerModuleCache.kt
index a904ef0..d3be06b 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/JsPerModuleCache.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/ic/JsPerModuleCache.kt
@@ -35,7 +35,10 @@
val crossModuleReferencesHash = ICHash.fromProtoStream(this)
val reexportedInModuleWithName = ifTrue { readString() }
val importedWithEffectInModuleWithName = ifTrue { readString() }
- val (definitions, nameBindings, optionalCrossModuleImports) = fetchJsIrModuleHeaderNames()
+ val initializer = fetchJsIrModuleHeaderNames()
+ val definitions = initializer.definitions
+ val nameBindings = initializer.nameBindings
+ val optionalCrossModuleImports = initializer.optionalCrossModuleImports
CachedModuleInfo(
artifact = this@fetchModuleInfo,
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/jsCompiler.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/jsCompiler.kt
index 303000d..1cccaf7 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/jsCompiler.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/jsCompiler.kt
@@ -49,8 +49,13 @@
filesToLower: Set<String>? = null,
granularity: JsGenerationGranularity = JsGenerationGranularity.WHOLE_PROGRAM,
): LoweredIr {
- val (moduleFragment: IrModuleFragment, dependencyModules, irBuiltIns, symbolTable, deserializer, moduleToName) =
- loadIr(depsDescriptors, irFactory, verifySignatures, filesToLower, loadFunctionInterfacesIntoStdlib = true)
+ val initializer = loadIr(depsDescriptors, irFactory, verifySignatures, filesToLower, loadFunctionInterfacesIntoStdlib = true)
+ val moduleFragment: IrModuleFragment = initializer.module
+ val dependencyModules = initializer.allDependencies
+ val irBuiltIns = initializer.bultins
+ val symbolTable = initializer.symbolTable
+ val deserializer = initializer.deserializer
+ val moduleToName = initializer.moduleFragmentToUniqueName
return compileIr(
moduleFragment,
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BridgesConstruction.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BridgesConstruction.kt
index bf4d5d6..af50ae4 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BridgesConstruction.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BridgesConstruction.kt
@@ -86,7 +86,9 @@
val result = mutableListOf<IrDeclaration>()
- for ((from, to) in bridgesToGenerate) {
+ for (initializer in bridgesToGenerate) {
+ val from = initializer.from
+ val to = initializer.to
if (!from.function.parentAsClass.isInterface &&
from.function.isReal &&
from.function.modality != Modality.ABSTRACT &&
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PrepareCollectionsToExportLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PrepareCollectionsToExportLowering.kt
index 99aec8f..e8bb77e 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PrepareCollectionsToExportLowering.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PrepareCollectionsToExportLowering.kt
@@ -98,10 +98,11 @@
)
private fun IrClass.addCompanionWithJsFactoryFunction() {
- val (factoryMethodName, factoryMethodForTheCollectionSymbol) =
- typesToItsFactoryMethods[symbol] ?: irError("Unexpected collection") {
- withIrEntry("this", this@addCompanionWithJsFactoryFunction)
- }
+ val initializer = typesToItsFactoryMethods[symbol] ?: irError("Unexpected collection") {
+ withIrEntry("this", this@addCompanionWithJsFactoryFunction)
+ }
+ val factoryMethodName = initializer.name
+ val factoryMethodForTheCollectionSymbol = initializer.callee
val companionObject = context.irFactory.createClass(
startOffset = UNDEFINED_OFFSET,
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ThrowableLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ThrowableLowering.kt
index 08d38d5..f7595e7 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ThrowableLowering.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ThrowableLowering.kt
@@ -67,7 +67,9 @@
expression.transformChildren(this, data)
if (expression.symbol !in throwableConstructors) return expression
- val (messageArg, causeArg) = expression.extractThrowableArguments()
+ val initializer = expression.extractThrowableArguments()
+ val messageArg = initializer.message
+ val causeArg = initializer.cause
return expression.run {
IrCallImpl(
@@ -85,7 +87,9 @@
expression.transformChildren(this, data)
if (expression.symbol !in throwableConstructors) return expression
- val (messageArg, causeArg) = expression.extractThrowableArguments()
+ val initializer = expression.extractThrowableArguments()
+ val messageArg = initializer.message
+ val causeArg = initializer.cause
val klass = data as IrClass
val thisReceiver = IrGetValueImpl(expression.startOffset, expression.endOffset, klass.thisReceiver!!.symbol)
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/PerFileGenerator.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/PerFileGenerator.kt
index 0e22f3e..34e8d01 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/PerFileGenerator.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/PerFileGenerator.kt
@@ -55,7 +55,9 @@
hasModuleLevelEffect = true
}
- generatedArtifact.takeTestEnvironmentOwnership()?.let { (testFunction, suiteFunction) ->
+ generatedArtifact.takeTestEnvironmentOwnership()?.let { initializer ->
+ val testFunction = initializer.testFunctionTag
+ val suiteFunction = initializer.suiteFunctionTag
testFunctions.putToMultiMap(generatedArtifact.packageFqn, testFunction)
suiteFunctionTag = suiteFunction
}
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsAstUtils.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsAstUtils.kt
index d8ee4eb..518d54e 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsAstUtils.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsAstUtils.kt
@@ -639,7 +639,9 @@
if (startOffset == UNDEFINED_OFFSET || endOffset == UNDEFINED_OFFSET) return null
val path = fileEntry.name
val offset = offsetSelector()
- val (startLine, startColumn) = fileEntry.getLineAndColumnNumbers(offset)
+ val initializer = fileEntry.getLineAndColumnNumbers(offset)
+ val startLine = initializer.line
+ val startColumn = initializer.column
return JsLocation(path, startLine, startColumn)
}
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsCode.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsCode.kt
index e976b22..754d178 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsCode.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/jsCode.kt
@@ -43,7 +43,10 @@
sourceInfo: JsLocation?
): List<JsStatement>? {
// TODO: support proper symbol linkage and label clash resolution
- val (fileName, startLine, offset) = sourceInfo ?: JsLocation("<js-code>", 0, 0)
+ val initializer = sourceInfo ?: JsLocation("<js-code>", 0, 0)
+ val fileName = initializer.file
+ val startLine = initializer.startLine
+ val offset = initializer.startChar
val jsCode = foldString(code, context) ?: return null
// Parser can change local or global scope.
diff --git a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt
index a427cf3..69f90ac 100644
--- a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt
+++ b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt
@@ -408,10 +408,11 @@
}
// Only allow generation of one inline method at a time, to avoid deadlocks when files call inline methods of each other.
- val (node, smap) =
- generatedInlineMethods[method] ?: synchronized(context.inlineMethodGenerationLock) {
- generatedInlineMethods.getOrPut(method) { FunctionCodegen(method, this).generate() }
- }
+ val initializer = generatedInlineMethods[method] ?: synchronized(context.inlineMethodGenerationLock) {
+ generatedInlineMethods.getOrPut(method) { FunctionCodegen(method, this).generate() }
+ }
+ val node = initializer.node
+ val smap = initializer.classSMAP
return SMAPAndMethodNode(cloneMethodNode(node), smap)
}
@@ -421,7 +422,9 @@
return
}
- val (node, smap) = generateMethodNode(method)
+ val initializer = generateMethodNode(method)
+ val node = initializer.node
+ val smap = initializer.classSMAP
node.preprocessSuspendMarkers(
method.origin == JvmLoweredDeclarationOrigin.FOR_INLINE_STATE_MACHINE_TEMPLATE || method.isEffectivelyInlineOnly(),
method.origin == JvmLoweredDeclarationOrigin.FOR_INLINE_STATE_MACHINE_TEMPLATE_CAPTURES_CROSSINLINE
diff --git a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt
index 07ee199..770cf3c 100644
--- a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt
+++ b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt
@@ -112,7 +112,9 @@
generateAnnotationDefaultValueIfNeeded(methodVisitor)
SMAP(listOf())
} else if (notForInline != null) {
- val (originalNode, smap) = classCodegen.generateMethodNode(notForInline)
+ val initializer = classCodegen.generateMethodNode(notForInline)
+ val originalNode = initializer.node
+ val smap = initializer.classSMAP
originalNode.accept(MethodBodyVisitor(methodVisitor))
smap
} else {
diff --git a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineDefaultCodegen.kt b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineDefaultCodegen.kt
index a224fd7..959bc58 100644
--- a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineDefaultCodegen.kt
+++ b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineDefaultCodegen.kt
@@ -43,7 +43,9 @@
isInsideIfCondition: Boolean
) {
val function = expression.symbol.owner
- val (node, smap) = codegen.classCodegen.generateMethodNode(function)
+ val initializer = codegen.classCodegen.generateMethodNode(function)
+ val node = initializer.node
+ val smap = initializer.classSMAP
val argsSize = argumentsSize(callableMethod.asmMethod.descriptor, function.isStatic)
val mv = object : MethodBodyVisitor(codegen.visitor) {
override fun visitLocalVariable(name: String, desc: String, signature: String?, start: Label, end: Label, index: Int) {
diff --git a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/SwitchGenerator.kt b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/SwitchGenerator.kt
index c76491b6..1614b0b 100644
--- a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/SwitchGenerator.kt
+++ b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/SwitchGenerator.kt
@@ -293,7 +293,9 @@
with(codegen) {
val endLabel = Label()
- for ((thenExpression, label) in expressionToLabels) {
+ for (initializer in expressionToLabels) {
+ val thenExpression = initializer.expression
+ val label = initializer.label
mv.visitLabel(label)
thenExpression.accept(this, data).also {
if (elseExpression != null) {
@@ -463,9 +465,13 @@
// Multiple strings can be hashed into the same bucket.
// Generate an if cascade to resolve that for each bucket.
- for ((hash, switchLabel) in hashAndSwitchLabels) {
+ for (initializer in hashAndSwitchLabels) {
+ val hash = initializer.value
+ val switchLabel = initializer.label
mv.visitLabel(switchLabel)
- for ((string, label) in hashToStringAndExprLabels[hash]!!) {
+ for (initializer in hashToStringAndExprLabels[hash]!!) {
+ val string = initializer.value
+ val label = initializer.label
noLineNumberScope {
subject.accept(this, data).materialize()
}
diff --git a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt
index 1306fef..d9f22e0 100644
--- a/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt
+++ b/compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt
@@ -326,8 +326,15 @@
}
override fun invokeLowerings(state: GenerationState, input: CodegenFactory.BackendInput): CodegenFactory.CodegenInput {
- val (irModuleFragment, symbolTable, customPhaseConfig, irProviders, extensions, backendExtension, irPluginContext, notifyCodegenStart) =
- input as JvmIrBackendInput
+ val initializer = input as JvmIrBackendInput
+ val irModuleFragment = initializer.irModuleFragment
+ val symbolTable = initializer.symbolTable
+ val customPhaseConfig = initializer.phaseConfig
+ val irProviders = initializer.irProviders
+ val extensions = initializer.extensions
+ val backendExtension = initializer.backendExtension
+ val irPluginContext = initializer.pluginContext
+ val notifyCodegenStart = initializer.notifyCodegenStart
val irSerializer = if (
state.configuration.get(JVMConfigurationKeys.SERIALIZE_IR, JvmSerializeIrMode.NONE) != JvmSerializeIrMode.NONE
)
@@ -361,7 +368,11 @@
}
override fun invokeCodegen(input: CodegenFactory.CodegenInput) {
- val (state, context, module, notifyCodegenStart) = input as JvmIrCodegenInput
+ val initializer = input as JvmIrCodegenInput
+ val state = initializer.state
+ val context = initializer.context
+ val module = initializer.module
+ val notifyCodegenStart = initializer.notifyCodegenStart
fun hasErrors() = (state.diagnosticReporter as? BaseDiagnosticsCollector)?.hasErrors == true
diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/PropertyReferenceLowering.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/PropertyReferenceLowering.kt
index 7685a87..35cee92 100644
--- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/PropertyReferenceLowering.kt
+++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/PropertyReferenceLowering.kt
@@ -315,9 +315,10 @@
// For delegated properties, the getter and setter contain a reference each as the second argument to getValue
// and setValue. Since it's highly unlikely that anyone will call get/set on these, optimize for space.
return context.createIrBuilder(currentScope!!.scope.scopeOwnerSymbol, expression.startOffset, expression.endOffset).run {
- val (_, index) = data.kProperties.getOrPut(expression.symbol) {
+ val initializer = data.kProperties.getOrPut(expression.symbol) {
PropertyInstance(createReflectedKProperty(expression), data.kProperties.size)
}
+ val index = initializer.index
irCall(arrayItemGetter).apply {
dispatchReceiver = irGetField(null, data.kPropertiesField)
putValueArgument(0, irInt(index))
diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/locationUtils.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/locationUtils.kt
index e1bd464..2135185 100644
--- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/locationUtils.kt
+++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/locationUtils.kt
@@ -42,7 +42,9 @@
if (hasSyntheticOrUndefinedLocation) return SourceLocation.NoLocation("Synthetic declaration")
val path = fileEntry.name
- val (line, column) = type.getLineAndColumnNumberFor(this, fileEntry)
+ val initializer = type.getLineAndColumnNumberFor(this, fileEntry)
+ val line = initializer.line
+ val column = initializer.column
if (line < 0 || column < 0) return SourceLocation.NoLocation("startLine or startColumn < 0")
diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/wasmCompiler.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/wasmCompiler.kt
index 768e0b2..2dd115e 100644
--- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/wasmCompiler.kt
+++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/wasmCompiler.kt
@@ -65,7 +65,11 @@
generateTypeScriptFragment: Boolean,
propertyLazyInitialization: Boolean,
): LoweredIrWithExtraArtifacts {
- val (moduleFragment, dependencyModules, irBuiltIns, symbolTable, irLinker) = irModuleInfo
+ val moduleFragment = irModuleInfo.module
+ val dependencyModules = irModuleInfo.allDependencies
+ val irBuiltIns = irModuleInfo.bultins
+ val symbolTable = irModuleInfo.symbolTable
+ val irLinker = irModuleInfo.deserializer
val allModules = when (mainModule) {
is MainModule.SourceFiles -> dependencyModules + listOf(moduleFragment)
diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/fragments/FragmentCompilerSymbolTableDecorator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/fragments/FragmentCompilerSymbolTableDecorator.kt
index 1b3fc82..06cd270 100644
--- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/fragments/FragmentCompilerSymbolTableDecorator.kt
+++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/fragments/FragmentCompilerSymbolTableDecorator.kt
@@ -40,10 +40,12 @@
if (declaration !is ReceiverParameterDescriptor) return super.referenceValueParameter(declaration)
val finderPredicate = when (val receiverValue = declaration.value) {
- is ExtensionReceiver, is ContextReceiver -> { (targetDescriptor, _): EvaluatorFragmentParameterInfo ->
+ is ExtensionReceiver, is ContextReceiver -> { el: EvaluatorFragmentParameterInfo ->
+ val targetDescriptor = el.descriptor
receiverValue == (targetDescriptor as? ReceiverParameterDescriptor)?.value
}
- is ThisClassReceiver -> { (targetDescriptor, _): EvaluatorFragmentParameterInfo ->
+ is ThisClassReceiver -> { el: EvaluatorFragmentParameterInfo ->
+ val targetDescriptor = el.descriptor
receiverValue.classDescriptor == targetDescriptor.original
}
else -> TODO("Unimplemented")
@@ -61,10 +63,12 @@
val fi = fragmentInfo ?: return super.referenceValue(value)
val finderPredicate = when (value) {
- is AbstractReceiverParameterDescriptor -> { (targetDescriptor, _): EvaluatorFragmentParameterInfo ->
+ is AbstractReceiverParameterDescriptor -> { el: EvaluatorFragmentParameterInfo ->
+ val targetDescriptor = el.descriptor
value.containingDeclaration == targetDescriptor
}
- else -> { (targetDescriptor, _): EvaluatorFragmentParameterInfo ->
+ else -> { el: EvaluatorFragmentParameterInfo ->
+ val targetDescriptor = el.descriptor
targetDescriptor == value
}
}
diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrFileEntry.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrFileEntry.kt
index 2c8af9b..d2eba3e 100644
--- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrFileEntry.kt
+++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/IrFileEntry.kt
@@ -56,8 +56,12 @@
}
override fun getSourceRangeInfo(beginOffset: Int, endOffset: Int): SourceRangeInfo {
- val (startLineNumber, startColumnNumber) = getLineAndColumnNumbers(beginOffset)
- val (endLineNumber, endColumnNumber) = getLineAndColumnNumbers(endOffset)
+ val initializer = getLineAndColumnNumbers(beginOffset)
+ val startLineNumber = initializer.line
+ val startColumnNumber = initializer.column
+ val initializer2 = getLineAndColumnNumbers(endOffset)
+ val endLineNumber = initializer2.line
+ val endColumnNumber = initializer2.column
return SourceRangeInfo(
filePath = name,
startOffset = beginOffset,
diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/linkage/partial/PartialLinkageUtils.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/linkage/partial/PartialLinkageUtils.kt
index c3fc033..865f359 100644
--- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/linkage/partial/PartialLinkageUtils.kt
+++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/linkage/partial/PartialLinkageUtils.kt
@@ -67,7 +67,9 @@
override val module = Module.Real(file.module.name)
override fun computeLocationForOffset(offset: Int): PartialLinkageLogger.Location {
- val (line, column) = file.fileEntry.getLineAndColumnNumbers(offset)
+ val initializer = file.fileEntry.getLineAndColumnNumbers(offset)
+ val line = initializer.line
+ val column = initializer.column
return PartialLinkageLogger.Location(
moduleName = module.name,
filePath = file.fileEntry.name,
diff --git a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/print/symbol/SymbolRemapperPrinter.kt b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/print/symbol/SymbolRemapperPrinter.kt
index f995953..f266935 100644
--- a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/print/symbol/SymbolRemapperPrinter.kt
+++ b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/print/symbol/SymbolRemapperPrinter.kt
@@ -107,7 +107,9 @@
if (symbolRemapperSuperTypes.isEmpty()) {
val kDoc = buildString {
append("Remaps symbols stored, e.g., in the following properties (not necessarily limited to those properties):")
- for ((_, fieldName, _, element) in fields) {
+ for (initializer in fields) {
+ val fieldName = initializer.fieldName
+ val element = initializer.fieldContainer
appendLine()
append("- [${element.render()}.$fieldName]")
}
diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/issues/UserVisibleIrModulesSupport.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/issues/UserVisibleIrModulesSupport.kt
index 7ed2ff9..1cb734c 100644
--- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/issues/UserVisibleIrModulesSupport.kt
+++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/issues/UserVisibleIrModulesSupport.kt
@@ -190,7 +190,8 @@
private fun Map<ResolvedDependencyId, ModuleWithUninitializedDependencies>.stampDependenciesWithRequestedVersionEqualToSelectedVersion(): Map<ResolvedDependencyId, ResolvedDependency> {
return mapValues { (moduleId, moduleWithUninitializedDependencies) ->
- val (module, outgoingDependencyIds) = moduleWithUninitializedDependencies
+ val module = moduleWithUninitializedDependencies.module
+ val outgoingDependencyIds = moduleWithUninitializedDependencies.outgoingDependencyIds
outgoingDependencyIds.forEach { outgoingDependencyId ->
val dependencyModule = getValue(outgoingDependencyId).module
dependencyModule.requestedVersionsByIncomingDependencies[moduleId] = dependencyModule.selectedVersion
diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageErrorMessages.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageErrorMessages.kt
index 9e74aca..9bd8722 100644
--- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageErrorMessages.kt
+++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageErrorMessages.kt
@@ -491,7 +491,9 @@
}
private fun StringBuilder.expression(expression: IrExpression, continuation: (ExpressionKind) -> Appendable): Appendable {
- val (expressionKind, referencedDeclarationKind) = expression.expression
+ val initializer = expression.expression
+ val expressionKind = initializer.kind
+ val referencedDeclarationKind = initializer.referencedDeclarationKind
// Prefix may be null. But when it's not null, it is always capitalized.
val hasPrefix = expressionKind.prefix != null
diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/CityHash.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/CityHash.kt
index 11531c9..421b3e7 100644
--- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/CityHash.kt
+++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/CityHash.kt
@@ -231,7 +231,8 @@
var pos = pos
var len = len
- var (a, b) = seed
+ var a = seed.lowBytes
+ var b = seed.highBytes
var c: ULong
var d: ULong
@@ -271,7 +272,8 @@
var v = ULongArray(2)
var w = ULongArray(2)
- var (x, y) = seed
+ var x = seed.lowBytes
+ var y = seed.highBytes
var z = len.toULong() * k1
v[0] = rotate(y xor k1, 49) * k1 + fetch64(s, pos)
diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightPsiClassObjectAccessExpression.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightPsiClassObjectAccessExpression.kt
index d5abad6..70e797e 100644
--- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightPsiClassObjectAccessExpression.kt
+++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/elements/KtLightPsiClassObjectAccessExpression.kt
@@ -22,9 +22,11 @@
KtLightPsiLiteral(kotlinOrigin, lightParent), PsiClassObjectAccessExpression {
override fun getType(): PsiType {
val bindingContext = LightClassGenerationSupport.getInstance(this.project).analyze(kotlinOrigin)
- val (classId, arrayDimensions) = bindingContext[BindingContext.COMPILE_TIME_VALUE, kotlinOrigin]
+ val initializer = bindingContext[BindingContext.COMPILE_TIME_VALUE, kotlinOrigin]
?.toConstantValue(TypeUtils.NO_EXPECTED_TYPE)?.safeAs<KClassValue>()?.value
?.safeAs<KClassValue.Value.NormalClass>()?.value ?: return PsiTypes.voidType()
+ val classId = initializer.classId
+ val arrayDimensions = initializer.arrayNestedness
var type = psiType(classId.asSingleFqName().asString(), kotlinOrigin, boxPrimitiveType = arrayDimensions > 0)
repeat(arrayDimensions) {
type = type.createArrayType()
diff --git a/compiler/psi/src/org/jetbrains/kotlin/parsing/ParseUtils.kt b/compiler/psi/src/org/jetbrains/kotlin/parsing/ParseUtils.kt
index 8cc06d9..33aa0be 100644
--- a/compiler/psi/src/org/jetbrains/kotlin/parsing/ParseUtils.kt
+++ b/compiler/psi/src/org/jetbrains/kotlin/parsing/ParseUtils.kt
@@ -66,7 +66,9 @@
}
}
- val (number, radix) = extractRadix(numberWithoutSuffix)
+ val initializer = extractRadix(numberWithoutSuffix)
+ val number = initializer.number
+ val radix = initializer.radix
if (isUnsigned) {
java.lang.Long.parseUnsignedLong(number, radix)
diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/createByPattern.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/createByPattern.kt
index 0c5f5e0..56798a3 100644
--- a/compiler/psi/src/org/jetbrains/kotlin/psi/createByPattern.kt
+++ b/compiler/psi/src/org/jetbrains/kotlin/psi/createByPattern.kt
@@ -142,7 +142,9 @@
arg
}
- val (processedText, allPlaceholders) = processPattern(pattern, args)
+ val initializer = processPattern(pattern, args)
+ val processedText = initializer.processedText
+ val allPlaceholders = initializer.placeholders
var resultElement: KtElement = factory(processedText.trim())
val project = resultElement.project
@@ -159,7 +161,8 @@
if (arg is String) continue // already in the text
val expectedElementType = (argumentTypes[n] as PsiElementPlaceholderArgumentType<*, *>).placeholderClass
- for ((range, _) in placeholders) {
+ for (initializer in placeholders) {
+ val range = initializer.range
val token = resultElement.findElementAt(range.startOffset)!!
for (element in token.parentsWithSelf) {
val elementRange = element.textRange.shiftRight(-start)
diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintInjector.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintInjector.kt
index 984a1f3..b481827 100644
--- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintInjector.kt
+++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintInjector.kt
@@ -513,7 +513,10 @@
type: KotlinTypeMarker,
constraintContext: ConstraintContext
) {
- val (kind, derivedFrom, inputTypePosition, isNullabilityConstraint) = constraintContext
+ val kind = constraintContext.kind
+ val derivedFrom = constraintContext.derivedFrom
+ val inputTypePosition = constraintContext.inputTypePositionBeforeIncorporation
+ val isNullabilityConstraint = constraintContext.isNullabilityConstraint
var targetType = type
if (targetType.isUninferredParameter()) {
diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/TypeVariableDirectionCalculator.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/TypeVariableDirectionCalculator.kt
index 0ec39f6..9d25d1e 100644
--- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/TypeVariableDirectionCalculator.kt
+++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/TypeVariableDirectionCalculator.kt
@@ -69,7 +69,9 @@
directions[variable] = direction
- for ((otherVariable, otherDirection) in getConstraintDependencies(variable, direction)) {
+ for (initializer in getConstraintDependencies(variable, direction)) {
+ val otherVariable = initializer.variableWithConstraints
+ val otherDirection = initializer.direction
enterToNode(otherVariable, otherDirection)
}
}
diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/CompletionModeCalculator.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/CompletionModeCalculator.kt
index d5fd8e8..1cf14f5 100644
--- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/CompletionModeCalculator.kt
+++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/CompletionModeCalculator.kt
@@ -120,7 +120,8 @@
}
private fun updateDirection(directionForVariable: FixationDirectionForVariable) {
- val (variable, newDirection) = directionForVariable
+ val variable = directionForVariable.variable
+ val newDirection = directionForVariable.direction
fixationDirectionsForVariables[variable]?.let { oldDirection ->
if (oldDirection != FixationDirection.EQUALITY && oldDirection != newDirection)
fixationDirectionsForVariables[variable] = FixationDirection.EQUALITY
diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/PostponedArgumentsAnalyzer.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/PostponedArgumentsAnalyzer.kt
index 449c44d..f4993d3 100644
--- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/PostponedArgumentsAnalyzer.kt
+++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/PostponedArgumentsAnalyzer.kt
@@ -152,8 +152,9 @@
diagnosticHolder: KotlinDiagnosticsHolder,
substitute: (KotlinType) -> UnwrappedType = c.createSubstituteFunctorForLambdaAnalysis().substitute
) {
- val (returnArgumentsInfo, inferenceSession, hasInapplicableCallForBuilderInference) =
- returnArgumentsAnalysisResult
+ val returnArgumentsInfo = returnArgumentsAnalysisResult.returnArgumentsInfo
+ val inferenceSession = returnArgumentsAnalysisResult.inferenceSession
+ val hasInapplicableCallForBuilderInference = returnArgumentsAnalysisResult.hasInapplicableCallForBuilderInference
if (hasInapplicableCallForBuilderInference) {
inferenceSession?.initializeLambda(lambda)
diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ResolutionParts.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ResolutionParts.kt
index ffc9af5..5cc5c05 100644
--- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ResolutionParts.kt
+++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/ResolutionParts.kt
@@ -900,7 +900,11 @@
getReceiverArgumentWithConstraintIfCompatible(argument, candidateContextReceiverParameter)
}.toList()
if (applicableArguments.size == 1) {
- val (argument, argumentType, expectedType, position) = applicableArguments.single()
+ val initializer = applicableArguments.single()
+ val argument = initializer.argument
+ val argumentType = initializer.argumentType
+ val expectedType = initializer.expectedType
+ val position = initializer.position
csBuilder.addSubtypeConstraint(argumentType, expectedType, position)
return argument
}
diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt
index 66f44f5..92c14e0 100644
--- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt
+++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt
@@ -344,7 +344,9 @@
name: Name,
extensionReceiver: ReceiverValueWithSmartCastInfo?
): Collection<CandidateWithBoundDispatchReceiver> =
- resolutionScope.getContributedObjectVariablesIncludeDeprecated(name, location).map { (classifier, isDeprecated) ->
+ resolutionScope.getContributedObjectVariablesIncludeDeprecated(name, location).map { initializer ->
+ val classifier = initializer.descriptor
+ val isDeprecated = initializer.isDeprecated
createCandidateDescriptor(
classifier,
dispatchReceiver = null,
@@ -531,7 +533,9 @@
name: Name,
location: LookupLocation
): Collection<DescriptorWithDeprecation<VariableDescriptor>> {
- val (classifier, isOwnerDeprecated) = getContributedClassifierIncludeDeprecated(name, location) ?: return emptyList()
+ val initializer = getContributedClassifierIncludeDeprecated(name, location) ?: return emptyList()
+ val classifier = initializer.descriptor
+ val isOwnerDeprecated = initializer.isDeprecated
val objectDescriptor = getFakeDescriptorForObject(classifier) ?: return emptyList()
return listOf(DescriptorWithDeprecation(objectDescriptor, isOwnerDeprecated))
}
diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/scopes/LexicalChainedScope.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/scopes/LexicalChainedScope.kt
index db42716..01329fc 100644
--- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/scopes/LexicalChainedScope.kt
+++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/scopes/LexicalChainedScope.kt
@@ -50,15 +50,19 @@
getFirstClassifierDiscriminateHeaders(memberScopes) { it.getContributedClassifier(name, location) }
override fun getContributedClassifierIncludeDeprecated(name: Name, location: LookupLocation): DescriptorWithDeprecation<ClassifierDescriptor>? {
- val (firstClassifier, isFirstDeprecated) = memberScopes.firstNotNullOfOrNull {
+ val initializer = memberScopes.firstNotNullOfOrNull {
it.getContributedClassifierIncludeDeprecated(name, location)
} ?: return null
+ val firstClassifier = initializer.descriptor
+ val isFirstDeprecated = initializer.isDeprecated
if (!isFirstDeprecated) return DescriptorWithDeprecation.createNonDeprecated(firstClassifier)
// Slow-path: try to find the same classifier, but without deprecation
for (scope in memberScopes) {
- val (descriptor, isDeprecated) = scope.getContributedClassifierIncludeDeprecated(name, location) ?: continue
+ val initializer = scope.getContributedClassifierIncludeDeprecated(name, location) ?: continue
+ val descriptor = initializer.descriptor
+ val isDeprecated = initializer.isDeprecated
if (descriptor == firstClassifier && !isDeprecated) return DescriptorWithDeprecation.createNonDeprecated(descriptor)
}
diff --git a/core/compiler.common.jvm/src/org/jetbrains/kotlin/builtins/jvm/JavaToKotlinClassMap.kt b/core/compiler.common.jvm/src/org/jetbrains/kotlin/builtins/jvm/JavaToKotlinClassMap.kt
index 3844c50..563568e 100644
--- a/core/compiler.common.jvm/src/org/jetbrains/kotlin/builtins/jvm/JavaToKotlinClassMap.kt
+++ b/core/compiler.common.jvm/src/org/jetbrains/kotlin/builtins/jvm/JavaToKotlinClassMap.kt
@@ -158,7 +158,10 @@
}
private fun addMapping(platformMutabilityMapping: PlatformMutabilityMapping) {
- val (javaClassId, readOnlyClassId, mutableClassId) = platformMutabilityMapping
+ val initializer = platformMutabilityMapping
+ val javaClassId = initializer.javaClass
+ val readOnlyClassId = initializer.kotlinReadOnly
+ val mutableClassId = initializer.kotlinMutable
add(javaClassId, readOnlyClassId)
addKotlinToJava(mutableClassId.asSingleFqName(), javaClassId)
diff --git a/core/compiler.common/src/org/jetbrains/kotlin/util/AttributeArrayOwner.kt b/core/compiler.common/src/org/jetbrains/kotlin/util/AttributeArrayOwner.kt
index 2d65c2d..80f0b88 100644
--- a/core/compiler.common/src/org/jetbrains/kotlin/util/AttributeArrayOwner.kt
+++ b/core/compiler.common/src/org/jetbrains/kotlin/util/AttributeArrayOwner.kt
@@ -58,7 +58,9 @@
val map = arrayMap as ArrayMapImpl<T>
map.remove(id)
if (map.size == 1) {
- val (index, value) = map.entries().first()
+ val initializer = map.entries().first()
+ val index = initializer.key
+ val value = initializer.value
arrayMap = OneElementArrayMap(value, index)
}
}
diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/JvmPackagePartProviderBase.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/JvmPackagePartProviderBase.kt
index 9c52a84..c31a12b 100644
--- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/JvmPackagePartProviderBase.kt
+++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/JvmPackagePartProviderBase.kt
@@ -48,7 +48,9 @@
private fun getPackageParts(packageFqName: String): Collection<PackageParts> {
val result = mutableMapOf<MappingsKey, PackageParts>()
- for ((root, mapping) in loadedModules) {
+ for (initializer in loadedModules) {
+ val root = initializer.key
+ val mapping = initializer.mapping
val newParts = mapping.findPackageParts(packageFqName) ?: continue
result[root]?.let { parts -> parts += newParts } ?: result.put(root, newParts)
}
@@ -56,7 +58,9 @@
}
override fun getAnnotationsOnBinaryModule(moduleName: String): List<ClassId> {
- return loadedModules.mapNotNull { (_, mapping, name) ->
+ return loadedModules.mapNotNull { initializer ->
+ val mapping = initializer.mapping
+ val name = initializer.name
if (name == moduleName) mapping.moduleData.annotations.map(ClassId::fromString) else null
}.flatten()
}
diff --git a/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/BuiltInFictitiousFunctionClassFactory.kt b/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/BuiltInFictitiousFunctionClassFactory.kt
index d4d3d6d..db7872d 100644
--- a/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/BuiltInFictitiousFunctionClassFactory.kt
+++ b/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/BuiltInFictitiousFunctionClassFactory.kt
@@ -49,7 +49,9 @@
if ("Function" !in className) return null // An optimization
val packageFqName = classId.packageFqName
- val (kind, arity) = FunctionTypeKindExtractor.Default.getFunctionalClassKindWithArity(packageFqName, className) ?: return null
+ val initializer = FunctionTypeKindExtractor.Default.getFunctionalClassKindWithArity(packageFqName, className) ?: return null
+ val kind = initializer.kind
+ val arity = initializer.arity
val builtInsFragments = module.getPackage(packageFqName).fragments.filterIsInstance<BuiltInsPackageFragment>()
diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/NotFoundClasses.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/NotFoundClasses.kt
index 8a85deb..6f653b0 100644
--- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/NotFoundClasses.kt
+++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/NotFoundClasses.kt
@@ -30,7 +30,9 @@
EmptyPackageFragmentDescriptor(module, fqName)
}
- private val classes = storageManager.createMemoizedFunction<ClassRequest, ClassDescriptor> { (classId, typeParametersCount) ->
+ private val classes = storageManager.createMemoizedFunction<ClassRequest, ClassDescriptor> { initializer ->
+ val classId = initializer.classId
+ val typeParametersCount = initializer.typeParametersCount
if (classId.isLocal) {
throw UnsupportedOperationException("Unresolved local class: $classId")
}
diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/constantValues.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/constantValues.kt
index 61b1246..ea953a7 100644
--- a/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/constantValues.kt
+++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/constantValues.kt
@@ -189,7 +189,9 @@
when (value) {
is Value.LocalClass -> return value.type
is Value.NormalClass -> {
- val (classId, arrayDimensions) = value.value
+ val initializer = value.value
+ val classId = initializer.classId
+ val arrayDimensions = initializer.arrayNestedness
val descriptor = module.findClassAcrossModuleDependencies(classId)
?: return ErrorUtils.createErrorType(ErrorTypeKind.UNRESOLVED_KCLASS_CONSTANT_VALUE, classId.toString(), arrayDimensions.toString())
diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt b/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt
index 78112a8..9b56b61 100644
--- a/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt
+++ b/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt
@@ -150,7 +150,9 @@
lowerBoundArguments.add(typeArgument)
upperBoundArguments.add(typeArgument)
} else {
- val (lower, upper) = approximateProjection(typeArgument)
+ val initializer = approximateProjection(typeArgument)
+ val lower = initializer.lower
+ val upper = initializer.upper
lowerBoundArguments.add(lower)
upperBoundArguments.add(upper)
}
@@ -168,8 +170,12 @@
}
private fun approximateProjection(typeArgument: TypeArgument): ApproximationBounds<TypeArgument> {
- val (inLower, inUpper) = approximateCapturedTypes(typeArgument.inProjection)
- val (outLower, outUpper) = approximateCapturedTypes(typeArgument.outProjection)
+ val initializer = approximateCapturedTypes(typeArgument.inProjection)
+ val inLower = initializer.lower
+ val inUpper = initializer.upper
+ val initializer2 = approximateCapturedTypes(typeArgument.outProjection)
+ val outLower = initializer2.lower
+ val outUpper = initializer2.upper
return ApproximationBounds(
lower = TypeArgument(typeArgument.typeParameter, inUpper, outLower),
upper = TypeArgument(typeArgument.typeParameter, inLower, outUpper)
diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/ClassDeserializer.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/ClassDeserializer.kt
index f1a8aa3..59fba77 100644
--- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/ClassDeserializer.kt
+++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/ClassDeserializer.kt
@@ -40,9 +40,13 @@
}
if (classId in BLACK_LIST) return null
- val (nameResolver, classProto, metadataVersion, sourceElement) = key.classData
+ val initializer = key.classData
?: components.classDataFinder.findClassData(classId)
?: return null
+ val nameResolver = initializer.nameResolver
+ val classProto = initializer.classProto
+ val metadataVersion = initializer.metadataVersion
+ val sourceElement = initializer.sourceElement
val outerClassId = classId.outerClassId
val outerContext = if (outerClassId != null) {
diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/RuntimeTypeMapper.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/RuntimeTypeMapper.kt
index 8d117df..986498a 100644
--- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/RuntimeTypeMapper.kt
+++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/RuntimeTypeMapper.kt
@@ -109,9 +109,10 @@
private val string: String = if (signature.hasGetter()) {
nameResolver.getString(signature.getter.name) + nameResolver.getString(signature.getter.desc)
} else {
- val (name, desc) =
- JvmProtoBufUtil.getJvmFieldSignature(proto, nameResolver, typeTable)
- ?: throw KotlinReflectionInternalError("No field signature for property: $descriptor")
+ val initializer = JvmProtoBufUtil.getJvmFieldSignature(proto, nameResolver, typeTable)
+ ?: throw KotlinReflectionInternalError("No field signature for property: $descriptor")
+ val name = initializer.name
+ val desc = initializer.desc
JvmAbi.getterName(name) + getManglingSuffix() + "()" + desc
}
diff --git a/generators/ide-iml-to-gradle-generator/src/org/jetbrains/kotlin/generators/imltogradle/Main.kt b/generators/ide-iml-to-gradle-generator/src/org/jetbrains/kotlin/generators/imltogradle/Main.kt
index d043ef9..a5ba66a 100644
--- a/generators/ide-iml-to-gradle-generator/src/org/jetbrains/kotlin/generators/imltogradle/Main.kt
+++ b/generators/ide-iml-to-gradle-generator/src/org/jetbrains/kotlin/generators/imltogradle/Main.kt
@@ -143,7 +143,9 @@
}
in intellijModulesToIgnore -> emptyList()
else -> {
- val (groupId, artifactId) = MavenArtifactsBuilder.generateMavenCoordinates(moduleName)
+ val initializer = MavenArtifactsBuilder.generateMavenCoordinates(moduleName)
+ val groupId = initializer.groupId
+ val artifactId = initializer.artifactId
listOf(
JpsLikeJarDependency(
GradleDependencyNotation.IntellijMavenDepGradleDependencyNotation(groupId, artifactId).dependencyNotation,
diff --git a/generators/protobuf/GenerateProtoBuf.kt b/generators/protobuf/GenerateProtoBuf.kt
index 9100464..481c179 100644
--- a/generators/protobuf/GenerateProtoBuf.kt
+++ b/generators/protobuf/GenerateProtoBuf.kt
@@ -92,7 +92,9 @@
}
private fun checkVersion() {
- val (stdout, stderr) = execAndGetOutput(PROTOC_EXE, "--version")
+ val initializer = execAndGetOutput(PROTOC_EXE, "--version")
+ val stdout = initializer.stdout
+ val stderr = initializer.stderr
val version = stdout.trim()
if (version.isEmpty()) {
@@ -108,7 +110,9 @@
listOf(PROTOC_EXE, protoPath, "--java_out=$outPath") +
PROTOBUF_PROTO_PATHS.map { "--proto_path=$it" }
println("running ${commandLine.joinToString(" ")}")
- val (stdout, stderr) = execAndGetOutput(*commandLine.toTypedArray())
+ val initializer = execAndGetOutput(*commandLine.toTypedArray())
+ val stdout = initializer.stdout
+ val stderr = initializer.stderr
print(stdout)
if (stderr.isNotEmpty()) {
throw AssertionError(stderr)
diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt
index 8c2454b..8cedbb1 100644
--- a/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt
+++ b/jps/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt
@@ -261,7 +261,8 @@
return null
}
- val (daemon, sessionId) = connection
+ val daemon = connection.compileService
+ val sessionId = connection.sessionId
val res = fn(sessionId, daemon)
// TODO: consider implementing connection retry, instead of fallback here
return res.takeUnless { it is CompileService.CallResult.Dying }?.get()
diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt
index 4e9bf03..cc936c1 100644
--- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt
+++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt
@@ -826,7 +826,10 @@
lookupStorageManager: JpsLookupStorageManager
): FilesToRecompile {
val reporter = JpsICReporter()
- val (dirtyLookupSymbols, dirtyClassFqNames, forceRecompile) = getChangedAndImpactedSymbols(caches, reporter)
+ val initializer = getChangedAndImpactedSymbols(caches, reporter)
+ val dirtyLookupSymbols = initializer.dirtyLookupSymbols
+ val dirtyClassFqNames = initializer.dirtyClassesFqNames
+ val forceRecompile = initializer.dirtyClassesFqNamesForceRecompile
val dirtyFilesFromLookups = lookupStorageManager.withLookupStorage {
mapLookupSymbolsToFiles(it, dirtyLookupSymbols, reporter)
}
diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/naming/NameSuggestion.kt b/js/js.frontend/src/org/jetbrains/kotlin/js/naming/NameSuggestion.kt
index c839626..970aaa1 100644
--- a/js/js.frontend/src/org/jetbrains/kotlin/js/naming/NameSuggestion.kt
+++ b/js/js.frontend/src/org/jetbrains/kotlin/js/naming/NameSuggestion.kt
@@ -205,7 +205,9 @@
parts.reverse()
val unmangledName = parts.joinToString("$")
- val (id, stable) = mangleNameIfNecessary(unmangledName, fixedDescriptor, bindingContext)
+ val initializer = mangleNameIfNecessary(unmangledName, fixedDescriptor, bindingContext)
+ val id = initializer.name
+ val stable = initializer.stable
return SuggestedName(listOf(id), stable, fixedDescriptor, current)
}
diff --git a/js/js.inliner/src/org/jetbrains/kotlin/js/coroutine/CoroutineBodyTransformer.kt b/js/js.inliner/src/org/jetbrains/kotlin/js/coroutine/CoroutineBodyTransformer.kt
index 2f1534c..e4f7c0e 100644
--- a/js/js.inliner/src/org/jetbrains/kotlin/js/coroutine/CoroutineBodyTransformer.kt
+++ b/js/js.inliner/src/org/jetbrains/kotlin/js/coroutine/CoroutineBodyTransformer.kt
@@ -206,7 +206,9 @@
override fun visitBreak(x: JsBreak) {
val targetStatement = breakContinueTargetStatements[x]!!
- val (targetBlock, targetTryDepth) = breakTargets[targetStatement]!!
+ val initializer = breakTargets[targetStatement]!!
+ val targetBlock = initializer.block
+ val targetTryDepth = initializer.tryDepth
referencedBlocks += targetBlock
jumpWithFinally(targetTryDepth + 1, targetBlock, x)
currentStatements += jump()
@@ -214,7 +216,9 @@
override fun visitContinue(x: JsContinue) {
val targetStatement = breakContinueTargetStatements[x]!!
- val (targetBlock, targetTryDepth) = continueTargets[targetStatement]!!
+ val initializer = continueTargets[targetStatement]!!
+ val targetBlock = initializer.block
+ val targetTryDepth = initializer.tryDepth
referencedBlocks += targetBlock
jumpWithFinally(targetTryDepth + 1, targetBlock, x)
currentStatements += jump()
diff --git a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/FunctionReader.kt b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/FunctionReader.kt
index 942eefe..bb81d29 100644
--- a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/FunctionReader.kt
+++ b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/FunctionReader.kt
@@ -85,7 +85,11 @@
private val moduleNameToInfo by lazy {
val result = HashMultimap.create<String, ModuleInfo>()
- JsLibraryUtils.traverseJsLibraries(config.libraries.map(::File)) { (content, path, sourceMapContent, file) ->
+ JsLibraryUtils.traverseJsLibraries(config.libraries.map(::File)) { initializer ->
+ val content = initializer.content
+ val path = initializer.path
+ val sourceMapContent = initializer.sourceMapContent
+ val file = initializer.file
var current = 0
while (true) {
@@ -255,11 +259,13 @@
val jsScope = JsRootScope(JsProgram())
val functionExpr = parseFunction(source, info.filePath, position, offset, ThrowExceptionOnErrorReporter, jsScope) ?: return null
functionExpr.fixForwardNameReferences()
- val (function, wrapper) = if (isWrapped) {
+ val initializer = if (isWrapped) {
InlineMetadata.decomposeWrapper(functionExpr) ?: return null
} else {
FunctionWithWrapper(functionExpr, null)
}
+ val function = initializer.function
+ val wrapper = initializer.wrapperBody
val wrapperStatements = wrapper?.statements?.filter { it !is JsReturn }
val sourceMap = info.sourceMap
diff --git a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/InlineAstVisitor.kt b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/InlineAstVisitor.kt
index a572ed4..1d97103 100644
--- a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/InlineAstVisitor.kt
+++ b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/InlineAstVisitor.kt
@@ -69,7 +69,9 @@
override fun endVisit(call: JsInvocation, ctx: JsContext<JsNode>) {
if (hasToBeInlined(call)) {
- val (inlineableBody, resultExpression) = jsInliner.inline(scope, call, lastStatementLevelContext.currentNode)
+ val initializer = jsInliner.inline(scope, call, lastStatementLevelContext.currentNode)
+ val inlineableBody = initializer.inlineableBody
+ val resultExpression = initializer.resultExpression
lastStatementLevelContext.addPrevious(JsAstUtils.flattenStatement(inlineableBody))
diff --git a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/InliningScope.kt b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/InliningScope.kt
index 193025e..23bf98b 100644
--- a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/InliningScope.kt
+++ b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/InliningScope.kt
@@ -152,7 +152,9 @@
private val additionalDeclarations = mutableListOf<JsStatement>()
override fun hasImport(name: JsName, tag: String): JsName? {
- return name.localAlias?.let { (name, tag) ->
+ return name.localAlias?.let { initializer ->
+ val name = initializer.name
+ val tag = initializer.tag
if (tag != null) {
if (tag !in existingBindings) {
addNameBinding(name, tag)
diff --git a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/JsInliner.kt b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/JsInliner.kt
index 2035f86..c916c1b 100644
--- a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/JsInliner.kt
+++ b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/JsInliner.kt
@@ -45,7 +45,9 @@
if (definitionFragment !in translationResult.newFragments) return
cycleReporter.processInlineFunction(inlineFn.fn, call) {
- val (fn, wrapperBody) = inlineFn.fn
+ val initializer = inlineFn.fn
+ val fn = initializer.function
+ val wrapperBody = initializer.wrapperBody
if (wrapperBody != null) {
ImportIntoWrapperInliningScope.process(wrapperBody, definitionFragment) { scope ->
@@ -65,7 +67,9 @@
val inliningContext = InliningContext(currentStatement)
- val (inlineableBody, resultExpression) = FunctionInlineMutator.getInlineableCallReplacement(call, function, inliningContext)
+ val initializer = FunctionInlineMutator.getInlineableCallReplacement(call, function, inliningContext)
+ val inlineableBody = initializer.inlineableBody
+ val resultExpression = initializer.resultExpression
// body of inline function can contain call to lambdas that need to be inlined
InlineAstVisitor(this, scope).accept<JsNode?>(inlineableBody)
diff --git a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/clean/simplifyWrappedFunctions.kt b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/clean/simplifyWrappedFunctions.kt
index e150fd5..58a31d6 100644
--- a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/clean/simplifyWrappedFunctions.kt
+++ b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/clean/simplifyWrappedFunctions.kt
@@ -22,7 +22,9 @@
fun simplifyWrappedFunctions(root: JsNode) {
val visitor = object : JsVisitorWithContextImpl() {
override fun endVisit(x: JsInvocation, ctx: JsContext<in JsNode>) {
- extractFunction(x)?.let { (function, wrapper) ->
+ extractFunction(x)?.let { initializer ->
+ val function = initializer.function
+ val wrapper = initializer.wrapperBody
if (wrapper != null && wrapper.statements.size == 1) {
ctx.replaceMe(function)
}
diff --git a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/context/FunctionDefinitionLoader.kt b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/context/FunctionDefinitionLoader.kt
index b13bfb2..6b0b82b 100644
--- a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/context/FunctionDefinitionLoader.kt
+++ b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/context/FunctionDefinitionLoader.kt
@@ -88,7 +88,9 @@
collectNamedFunctionsAndWrappers(listOf(this)),
collectAccessors(listOf(this)),
collectLocalFunctions(listOf(this))
- ).also { (functions, accessors) ->
+ ).also { initializer ->
+ val functions = initializer.functions
+ val accessors = initializer.accessors
(functions.values.asSequence() + accessors.values.asSequence()).forEach { f ->
functionsByFunctionNodes[f.function] = f
}
diff --git a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/util/collectUtils.kt b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/util/collectUtils.kt
index 845903b..10e84b1 100644
--- a/js/js.inliner/src/org/jetbrains/kotlin/js/inline/util/collectUtils.kt
+++ b/js/js.inliner/src/org/jetbrains/kotlin/js/inline/util/collectUtils.kt
@@ -199,7 +199,9 @@
if (left is JsNameRef) {
val name = left.name
if (name != null) {
- extractFunction(right)?.let { (function, wrapper) ->
+ extractFunction(right)?.let { initializer ->
+ val function = initializer.function
+ val wrapper = initializer.wrapperBody
namedFunctions[name] = Pair(FunctionWithWrapper(function, wrapper), right)
}
}
diff --git a/js/js.parser/src/org/jetbrains/kotlin/js/parser/sourcemaps/SourceMap.kt b/js/js.parser/src/org/jetbrains/kotlin/js/parser/sourcemaps/SourceMap.kt
index 757e009..661c3a2 100644
--- a/js/js.parser/src/org/jetbrains/kotlin/js/parser/sourcemaps/SourceMap.kt
+++ b/js/js.parser/src/org/jetbrains/kotlin/js/parser/sourcemaps/SourceMap.kt
@@ -43,7 +43,11 @@
val generatedLine = generatedLines[index]
val segmentsByColumn = group.segments.map { it.generatedColumnNumber to it }.toMap()
for (i in generatedLine.indices) {
- segmentsByColumn[i]?.let { (_, sourceFile, sourceLine, sourceColumn, name) ->
+ segmentsByColumn[i]?.let { initializer ->
+ val sourceFile = initializer.sourceFileName
+ val sourceLine = initializer.sourceLineNumber
+ val sourceColumn = initializer.sourceColumnNumber
+ val name = initializer.name
val nameIfPresent = if (name != null) "($name)" else ""
writer.print("<$sourceFile:${sourceLine + 1}:${sourceColumn + 1}$nameIfPresent>")
}
diff --git a/js/js.sourcemap/src/org/jetbrains/kotlin/js/sourceMap/SourceMapBuilderConsumer.kt b/js/js.sourcemap/src/org/jetbrains/kotlin/js/sourceMap/SourceMapBuilderConsumer.kt
index 76f0fe9..4afc639 100644
--- a/js/js.sourcemap/src/org/jetbrains/kotlin/js/sourceMap/SourceMapBuilderConsumer.kt
+++ b/js/js.sourcemap/src/org/jetbrains/kotlin/js/sourceMap/SourceMapBuilderConsumer.kt
@@ -45,7 +45,10 @@
// This branch is only taken on the legacy backend
if (sourceInfo.isFakePsiElement) return
try {
- val (sourceFilePath, startLine, startChar) = PsiUtils.extractLocationFromPsi(sourceInfo, pathResolver)
+ val initializer = PsiUtils.extractLocationFromPsi(sourceInfo, pathResolver)
+ val sourceFilePath = initializer.file
+ val startLine = initializer.startLine
+ val startChar = initializer.startChar
val psiFile = sourceInfo.containingFile
val file = File(psiFile.viewProvider.virtualFile.path)
val contentSupplier = if (provideCurrentModuleContent) {
diff --git a/js/js.translator/src/org/jetbrains/kotlin/js/translate/expression/LiteralFunctionTranslator.kt b/js/js.translator/src/org/jetbrains/kotlin/js/translate/expression/LiteralFunctionTranslator.kt
index 934e0fd..29c1b82 100644
--- a/js/js.translator/src/org/jetbrains/kotlin/js/translate/expression/LiteralFunctionTranslator.kt
+++ b/js/js.translator/src/org/jetbrains/kotlin/js/translate/expression/LiteralFunctionTranslator.kt
@@ -157,7 +157,9 @@
val localFunAlias = aliasRef?.getStaticRef() as? JsExpression
if (localFunAlias != null) {
- val (args, params) = moveCapturedLocalInside(this, name, localFunAlias)
+ val initializer = moveCapturedLocalInside(this, name, localFunAlias)
+ val args = initializer.arguments
+ val params = initializer.parameters
additionalArgs = args
additionalParams = params
}
diff --git a/js/js.translator/src/org/jetbrains/kotlin/js/translate/general/normalizeImportTags.kt b/js/js.translator/src/org/jetbrains/kotlin/js/translate/general/normalizeImportTags.kt
index 3792216..2524b38 100644
--- a/js/js.translator/src/org/jetbrains/kotlin/js/translate/general/normalizeImportTags.kt
+++ b/js/js.translator/src/org/jetbrains/kotlin/js/translate/general/normalizeImportTags.kt
@@ -14,7 +14,9 @@
fun JsProgramFragment.normalizeImportTags() {
nameBindings.replaceAll { binding ->
- val (tag, name) = binding
+ val initializer = binding
+ val tag = initializer.key
+ val name = initializer.name
imports[tag]?.let { import ->
extractImportTag(JsVars.JsVar(name, imports[tag]))?.let { newtag ->
diff --git a/libraries/kotlinx-metadata/src/kotlin/metadata/internal/Readers.kt b/libraries/kotlinx-metadata/src/kotlin/metadata/internal/Readers.kt
index 878279e..0ee58ed 100644
--- a/libraries/kotlinx-metadata/src/kotlin/metadata/internal/Readers.kt
+++ b/libraries/kotlinx-metadata/src/kotlin/metadata/internal/Readers.kt
@@ -327,7 +327,10 @@
v.errorCode = message?.errorCode
v.message = message?.message
- val (major, minor, patch) = message?.version ?: VersionRequirement.Version.INFINITY
+ val initializer = message?.version ?: VersionRequirement.Version.INFINITY
+ val major = initializer.major
+ val minor = initializer.minor
+ val patch = initializer.patch
v.version = KmVersion(major, minor, patch)
return v
}
diff --git a/libraries/kotlinx-metadata/src/kotlin/metadata/internal/Writers.kt b/libraries/kotlinx-metadata/src/kotlin/metadata/internal/Writers.kt
index f7dd1cd..76c22ce 100644
--- a/libraries/kotlinx-metadata/src/kotlin/metadata/internal/Writers.kt
+++ b/libraries/kotlinx-metadata/src/kotlin/metadata/internal/Writers.kt
@@ -58,7 +58,8 @@
if (argument == KmTypeProjection.STAR) {
t.projection = ProtoBuf.Type.Argument.Projection.STAR
} else {
- val (variance, argType) = argument
+ val variance = argument.variance
+ val argType = argument.type
if (variance == null || argType == null)
throw InconsistentKotlinMetadataException("Variance and type must be set for non-star type projection")
if (variance == KmVariance.IN) {
@@ -231,7 +232,10 @@
this.message = this@writeVersionRequirement[message]
}
}
- val (major, minor, patch) = kmVersionRequirement.version
+ val initializer = kmVersionRequirement.version
+ val major = initializer.major
+ val minor = initializer.minor
+ val patch = initializer.patch
VersionRequirement.Version(major, minor, patch).encode(
writeVersion = { t!!.version = it },
diff --git a/libraries/reflect/build.gradle.kts b/libraries/reflect/build.gradle.kts
index 061bcbc..74cc276 100644
--- a/libraries/reflect/build.gradle.kts
+++ b/libraries/reflect/build.gradle.kts
@@ -98,7 +98,9 @@
override fun hasTransformedResource(): Boolean = data.isNotEmpty()
override fun modifyOutputStream(os: ZipOutputStream, preserveFileTimestamps: Boolean) {
- for ((path, bytes) in data) {
+ for (initializer in data) {
+ val path = initializer.path
+ val bytes = initializer.bytes
os.putNextEntry(ZipEntry(path))
os.write(bytes)
}
diff --git a/libraries/scripting/common/src/kotlin/script/experimental/api/scriptCompilation.kt b/libraries/scripting/common/src/kotlin/script/experimental/api/scriptCompilation.kt
index 25c23b9..6a3ed57 100644
--- a/libraries/scripting/common/src/kotlin/script/experimental/api/scriptCompilation.kt
+++ b/libraries/scripting/common/src/kotlin/script/experimental/api/scriptCompilation.kt
@@ -302,7 +302,9 @@
val thisResult: ResultWithDiagnostics<ScriptCompilationConfiguration> = this.asSuccess()
return this[ScriptCompilationConfiguration.refineConfigurationOnAnnotations]
- ?.fold(thisResult) { config, (annotations, handler) ->
+ ?.fold(thisResult) { config, initializer ->
+ val annotations = initializer.annotations
+ val handler = initializer.handler
config.onSuccess {
// checking that the collected data contains expected annotations
if (annotations.none { foundAnnotationNames.contains(it.typeName) }) it.asSuccess()
diff --git a/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/CompoundDependenciesResolver.kt b/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/CompoundDependenciesResolver.kt
index 79b533f..4d8280b 100644
--- a/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/CompoundDependenciesResolver.kt
+++ b/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/CompoundDependenciesResolver.kt
@@ -69,7 +69,8 @@
val resolverGroups = mutableMapOf<Int, MutableList<ArtifactWithLocation>>()
for ((artifactWithLocation, resolverIndex) in artifactToResolverIndex) {
- val (artifact, sourceCodeLocation) = artifactWithLocation
+ val artifact = artifactWithLocation.artifact
+ val sourceCodeLocation = artifactWithLocation.sourceCodeLocation
var currentIndex = resolverIndex + 1
while (currentIndex < resolvers.size) {
diff --git a/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/ExternalDependenciesResolver.kt b/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/ExternalDependenciesResolver.kt
index 405af4f..dba4a6d 100644
--- a/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/ExternalDependenciesResolver.kt
+++ b/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/ExternalDependenciesResolver.kt
@@ -38,7 +38,12 @@
artifactsWithLocations: List<ArtifactWithLocation>,
options: Options = Options.Empty,
): ResultWithDiagnostics<List<File>> =
- artifactsWithLocations.map { (artifact, location) -> resolve(artifact, options, location) }.asSuccessIfAny()
+ artifactsWithLocations.map { initializer ->
+ val artifact = initializer.artifact
+ val location = initializer.sourceCodeLocation
+ resolve(artifact, options, location)
+
+ }.asSuccessIfAny()
fun addRepository(
repositoryCoordinates: RepositoryCoordinates,
diff --git a/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/annotations.kt b/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/annotations.kt
index 8fc6dd0..7d1ba84 100644
--- a/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/annotations.kt
+++ b/libraries/scripting/dependencies/src/kotlin/script/experimental/dependencies/annotations.kt
@@ -37,7 +37,9 @@
annotations: Iterable<ScriptSourceAnnotation<*>>
): ResultWithDiagnostics<List<File>> {
val reports = mutableListOf<ScriptDiagnostic>()
- annotations.forEach { (annotation, locationWithId) ->
+ annotations.forEach { initializer ->
+ val annotation = initializer.annotation
+ val locationWithId = initializer.location
when (annotation) {
is Repository -> {
val options = SimpleExternalDependenciesResolverOptionsParser(*annotation.options, locationWithId = locationWithId)
@@ -61,7 +63,9 @@
}
return reports + annotations.filterByAnnotationType<DependsOn>()
- .flatMapSuccess { (annotation, locationWithId) ->
+ .flatMapSuccess { initializer ->
+ val annotation = initializer.annotation
+ val locationWithId = initializer.location
SimpleExternalDependenciesResolverOptionsParser(
*annotation.options,
locationWithId = locationWithId
diff --git a/libraries/scripting/jvm/src/kotlin/script/experimental/jvm/compat/diagnosticsUtil.kt b/libraries/scripting/jvm/src/kotlin/script/experimental/jvm/compat/diagnosticsUtil.kt
index 941d4df..8d3a64b 100644
--- a/libraries/scripting/jvm/src/kotlin/script/experimental/jvm/compat/diagnosticsUtil.kt
+++ b/libraries/scripting/jvm/src/kotlin/script/experimental/jvm/compat/diagnosticsUtil.kt
@@ -50,13 +50,20 @@
fun mapToLegacyScriptReportPosition(pos: SourceCode.Location?): ScriptReport.Position? =
pos?.let { ScriptReport.Position(pos.start.line, pos.start.col, pos.end?.line, pos.end?.col) }
-fun Iterable<ScriptReport>.mapToDiagnostics(): List<ScriptDiagnostic> = map { (message, severity, position) ->
+fun Iterable<ScriptReport>.mapToDiagnostics(): List<ScriptDiagnostic> = map { initializer ->
+ val message = initializer.message
+ val severity = initializer.severity
+ val position = initializer.position
ScriptDiagnostic(
ScriptDiagnostic.unspecifiedError, message, mapLegacyDiagnosticSeverity(severity), null, mapLegacyScriptPosition(position)
)
}
-fun Iterable<ScriptDiagnostic>.mapToLegacyReports(): List<ScriptReport> = map { (_, message, severity, _, location, exception) ->
+fun Iterable<ScriptDiagnostic>.mapToLegacyReports(): List<ScriptReport> = map { initializer ->
+ val message = initializer.message
+ val severity = initializer.severity
+ val location = initializer.location
+ val exception = initializer.exception
val reportMessage = if (exception == null) message else "$message ($exception)"
ScriptReport(reportMessage, mapToLegacyScriptReportSeverity(severity), mapToLegacyScriptReportPosition(location))
}
diff --git a/libraries/stdlib/jvm/src/kotlin/reflect/TypesJVM.kt b/libraries/stdlib/jvm/src/kotlin/reflect/TypesJVM.kt
index a025745..cc43471 100644
--- a/libraries/stdlib/jvm/src/kotlin/reflect/TypesJVM.kt
+++ b/libraries/stdlib/jvm/src/kotlin/reflect/TypesJVM.kt
@@ -45,8 +45,10 @@
if (jClass.isArray) {
if (jClass.componentType.isPrimitive) return jClass
- val (variance, elementType) = arguments.singleOrNull()
+ val initializer = arguments.singleOrNull()
?: throw IllegalArgumentException("kotlin.Array must have exactly one type argument: $this")
+ val variance = initializer.variance
+ val elementType = initializer.type
return when (variance) {
// Array<in ...> is always erased to Object[], and Array<*> is Object[].
null, KVariance.IN -> jClass
diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerWork.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerWork.kt
index f1dd4b8..5a7f27f 100644
--- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerWork.kt
+++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerWork.kt
@@ -213,7 +213,8 @@
)
} ?: throw RuntimeException(COULD_NOT_CONNECT_TO_DAEMON_MESSAGE) // TODO: Add root cause
- val (daemon, sessionId) = connection
+ val daemon = connection.compileService
+ val sessionId = connection.sessionId
if (log.isDebugEnabled) {
daemon.getDaemonJVMOptions().takeIf { it.isGood }?.let { jvmOpts ->
diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/android/internal/AndroidSubplugin.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/android/internal/AndroidSubplugin.kt
index a5cb1e4..9a82fef 100644
--- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/android/internal/AndroidSubplugin.kt
+++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/android/internal/AndroidSubplugin.kt
@@ -202,7 +202,10 @@
addSourceSetAsVariant("main")
- getVariantComponentNames(variantData)?.let { (variantName, flavorName, buildTypeName) ->
+ getVariantComponentNames(variantData)?.let { initializer ->
+ val variantName = initializer.variantName
+ val flavorName = initializer.flavorName
+ val buildTypeName = initializer.buildTypeName
addSourceSetAsVariant(buildTypeName)
if (flavorName.isNotEmpty()) {
diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/native/internal/CInteropCommonizerTask.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/native/internal/CInteropCommonizerTask.kt
index 3887bba..e34c784 100644
--- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/native/internal/CInteropCommonizerTask.kt
+++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/native/internal/CInteropCommonizerTask.kt
@@ -222,7 +222,9 @@
private fun getCInteropCommonizerGroupDependencies(group: CInteropCommonizerGroup): Set<CommonizerDependency> {
val dependencies = groupedCommonizerDependencies.getOrThrow()[group]
- ?.flatMap { (target, dependencies) ->
+ ?.flatMap { initializer ->
+ val target = initializer.commonizerTarget
+ val dependencies = initializer.dependencies
dependencies.files
.filter { file -> file.exists() && (file.isDirectory || file.extension == "klib") }
.map { file -> TargetedCommonizerDependency(target, file) }
diff --git a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/util/assertions.kt b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/util/assertions.kt
index d349751..173e43b 100644
--- a/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/util/assertions.kt
+++ b/libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/util/assertions.kt
@@ -39,7 +39,9 @@
val queue = ArrayDeque(taskDependencies.getDependencies(this).map { TaskAndDependants(it, listOf(this)) })
while (queue.isNotEmpty()) {
- val (task, dependants) = queue.removeFirst()
+ val initializer = queue.removeFirst()
+ val task = initializer.task
+ val dependants = initializer.dependants
if (task in visited) {
val dependencyChain = dependants.joinToString(" -> ") { it.name }
fail("Task $name has circular dependency: $dependencyChain")
diff --git a/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateStandardLib.kt b/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateStandardLib.kt
index 5050c16..3116779 100644
--- a/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateStandardLib.kt
+++ b/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateStandardLib.kt
@@ -54,7 +54,9 @@
}
}
- templateGroups.groupByFileAndWrite(targetsToGenerate = targetBaseDirs.keys) { (target, source) ->
+ templateGroups.groupByFileAndWrite(targetsToGenerate = targetBaseDirs.keys) { initializer ->
+ val target = initializer.target
+ val source = initializer.sourceFile
val targetDir = targetBaseDirs[target] ?: error("Target $target directory is not configured")
val platformSuffix = when (val platform = target.platform) {
Platform.Common -> ""
diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/MemberBuilder.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/MemberBuilder.kt
index 9b8de39..0f9d433 100644
--- a/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/MemberBuilder.kt
+++ b/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/MemberBuilder.kt
@@ -318,7 +318,11 @@
}
if (throwsExceptions.any()) {
builder.append(" * \n")
- throwsExceptions.forEach { (type, reason) -> builder.append(" * @throws $type $reason\n") }
+ throwsExceptions.forEach { initializer ->
+ val type = initializer.exceptionType
+ val reason = initializer.reason
+ builder.append(" * @throws $type $reason\n")
+ }
}
if (samples.any()) {
builder.append(" * \n")
diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/Writers.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/Writers.kt
index af266af..3b6e3af 100644
--- a/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/Writers.kt
+++ b/libraries/tools/kotlin-stdlib-gen/src/templates/dsl/Writers.kt
@@ -74,7 +74,8 @@
}
fun List<MemberBuilder>.writeTo(file: File, targetedSource: TargetedSourceFile) {
- val (target, sourceFile) = targetedSource
+ val target = targetedSource.target
+ val sourceFile = targetedSource.sourceFile
println("Generating file: $file")
file.parentFile.mkdirs()
FileWriter(file).use { writer ->
diff --git a/libraries/tools/kotlinp/klib/src/org/jetbrains/kotlin/kotlinp/klib/DeclarationIdOverMetadata.kt b/libraries/tools/kotlinp/klib/src/org/jetbrains/kotlin/kotlinp/klib/DeclarationIdOverMetadata.kt
index 95c5e49..7a346de 100644
--- a/libraries/tools/kotlinp/klib/src/org/jetbrains/kotlin/kotlinp/klib/DeclarationIdOverMetadata.kt
+++ b/libraries/tools/kotlinp/klib/src/org/jetbrains/kotlin/kotlinp/klib/DeclarationIdOverMetadata.kt
@@ -25,7 +25,8 @@
if (this == KmTypeProjection.STAR) {
TypeArgumentId.Star
} else {
- val (variance, type) = this
+ val variance = this.variance
+ val type = this.type
check(variance != null && type != null) { "Variance and type should not be null" }
TypeArgumentId.Regular(type.typeId(), variance.varianceId())
}
diff --git a/libraries/tools/kotlinp/src/org/jetbrains/kotlin/kotlinp/Kotlinp.kt b/libraries/tools/kotlinp/src/org/jetbrains/kotlin/kotlinp/Kotlinp.kt
index 4d2a647..21c2263 100644
--- a/libraries/tools/kotlinp/src/org/jetbrains/kotlin/kotlinp/Kotlinp.kt
+++ b/libraries/tools/kotlinp/src/org/jetbrains/kotlin/kotlinp/Kotlinp.kt
@@ -403,7 +403,8 @@
if (argument == KmTypeProjection.STAR) {
append("*")
} else {
- val (variance, argumentType) = argument
+ val variance = argument.variance
+ val argumentType = argument.type
if (variance == null || argumentType == null)
throw IllegalArgumentException("Variance and type must be set for non-star type projection")
diff --git a/native/commonizer-api/src/org/jetbrains/kotlin/commonizer/CliCommonizer.kt b/native/commonizer-api/src/org/jetbrains/kotlin/commonizer/CliCommonizer.kt
index 6f9413f..60f924e 100644
--- a/native/commonizer-api/src/org/jetbrains/kotlin/commonizer/CliCommonizer.kt
+++ b/native/commonizer-api/src/org/jetbrains/kotlin/commonizer/CliCommonizer.kt
@@ -42,7 +42,9 @@
add("-$DEPENDENCY_LIBRARIES_ALIAS"); add(dependencyLibraries.joinToString(";"))
}
add("-$LOG_LEVEL_ALIAS"); add(logLevel.name.lowercase())
- for ((settingKey, settingValue) in additionalSettings) {
+ for (initializer in additionalSettings) {
+ val settingKey = initializer.key
+ val settingValue = initializer.value
add("-${settingKey.alias}"); add(settingValue.toString())
}
}
@@ -62,7 +64,9 @@
add("-$OUTPUT_PATH_ALIAS"); add(outputDirectory.absolutePath)
add("-$OUTPUT_COMMONIZER_TARGETS_ALIAS"); add(outputTargets.joinToString(";") { it.identityString })
add("-$LOG_LEVEL_ALIAS"); add(logLevel.name.lowercase())
- for ((settingKey, settingValue) in additionalSettings) {
+ for (initializer in additionalSettings) {
+ val settingKey = initializer.key
+ val settingValue = initializer.value
add("-${settingKey.alias}"); add(settingValue.toString())
}
}
diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/CommonizerSettings.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/CommonizerSettings.kt
index d117fb2..4c1a1a1 100644
--- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/CommonizerSettings.kt
+++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/CommonizerSettings.kt
@@ -14,7 +14,11 @@
internal class MapBasedCommonizerSettings private constructor(
private val settings: Map<CommonizerSettings.Key<*>, Any>
) : CommonizerSettings {
- constructor(vararg settings: Setting<*>) : this(settings.associate { (k, v) -> k to v })
+ constructor(vararg settings: Setting<*>) : this(settings.associate { initializer ->
+ val k = initializer.key
+ val v = initializer.settingValue
+ k to v
+ })
override fun <T : Any> getSetting(key: CommonizerSettings.Key<T>): T {
@Suppress("UNCHECKED_CAST")
diff --git a/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirProvidedClassifiersByModules.kt b/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirProvidedClassifiersByModules.kt
index ef11290..c7032b7 100644
--- a/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirProvidedClassifiersByModules.kt
+++ b/native/commonizer/src/org/jetbrains/kotlin/commonizer/mergedtree/CirProvidedClassifiersByModules.kt
@@ -175,7 +175,9 @@
typeParameterIndexOffset: Int,
consumer: (CirEntityId, CirProvided.Classifier) -> Unit
) {
- val (classId, classProto) = classEntry
+ val initializer = classEntry
+ val classId = initializer.classId
+ val classProto = initializer.proto
val typeParameterNameToIndex = HashMap<Int, Int>()
diff --git a/native/executors/src/main/kotlin/org/jetbrains/kotlin/native/executors/HostExecutor.kt b/native/executors/src/main/kotlin/org/jetbrains/kotlin/native/executors/HostExecutor.kt
index 6f32ca3..e461add 100644
--- a/native/executors/src/main/kotlin/org/jetbrains/kotlin/native/executors/HostExecutor.kt
+++ b/native/executors/src/main/kotlin/org/jetbrains/kotlin/native/executors/HostExecutor.kt
@@ -170,9 +170,12 @@
environment().putAll(request.environment)
}.scoped { process ->
val streams = ProcessStreams(this, process, request.stdin, request.stdout, request.stderr)
- val (isTimeout, duration) = measureTimedValue {
+ val initializer = measureTimedValue {
!process.waitFor(request.timeout)
}
+ val isTimeout = initializer.value
+ val duration = initializer.duration
+
suspend fun cancel() {
streams.cancel()
process.destroyForcibly()
diff --git a/native/frontend/src/org/jetbrains/kotlin/resolve/konan/diagnostics/NativeObjCRefinementAnnotationChecker.kt b/native/frontend/src/org/jetbrains/kotlin/resolve/konan/diagnostics/NativeObjCRefinementAnnotationChecker.kt
index 6a6e127..0312893 100644
--- a/native/frontend/src/org/jetbrains/kotlin/resolve/konan/diagnostics/NativeObjCRefinementAnnotationChecker.kt
+++ b/native/frontend/src/org/jetbrains/kotlin/resolve/konan/diagnostics/NativeObjCRefinementAnnotationChecker.kt
@@ -46,7 +46,9 @@
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
if (descriptor !is ClassDescriptor || descriptor.kind != ClassKind.ANNOTATION_CLASS) return
- val (objCAnnotation, swiftAnnotation) = descriptor.findObjCExportMetaAnnotations() ?: return
+ val initializer = descriptor.findObjCExportMetaAnnotations() ?: return
+ val objCAnnotation = initializer.hidesFromObjCAnnotation
+ val swiftAnnotation = initializer.refinesInSwiftAnnotation
if (objCAnnotation == null && swiftAnnotation == null) return
if (objCAnnotation != null && swiftAnnotation != null) {
val reportLocation = DescriptorToSourceUtils.getSourceFromAnnotation(swiftAnnotation) ?: declaration
diff --git a/native/swift/swift-export-standalone/src/org/jetbrains/kotlin/swiftexport/standalone/builders/buildSwiftModule.kt b/native/swift/swift-export-standalone/src/org/jetbrains/kotlin/swiftexport/standalone/builders/buildSwiftModule.kt
index 3d1a260..4ff9146 100644
--- a/native/swift/swift-export-standalone/src/org/jetbrains/kotlin/swiftexport/standalone/builders/buildSwiftModule.kt
+++ b/native/swift/swift-export-standalone/src/org/jetbrains/kotlin/swiftexport/standalone/builders/buildSwiftModule.kt
@@ -43,8 +43,10 @@
config: SwiftExportConfig,
unsupportedDeclarationReporter: UnsupportedDeclarationReporter,
): SwiftModuleBuildResults {
- val (useSiteModule, mainModule, scopeProvider) =
- createModuleWithScopeProviderFromBinary(config.distribution, input, dependencies)
+ val initializer = createModuleWithScopeProviderFromBinary(config.distribution, input, dependencies)
+ val useSiteModule = initializer.useSiteModule
+ val mainModule = initializer.mainModule
+ val scopeProvider = initializer.scopeProvider
val moduleProvider = when (config.multipleModulesHandlingStrategy) {
MultipleModulesHandlingStrategy.OneToOneModuleMapping -> SirOneToOneModuleProvider()
MultipleModulesHandlingStrategy.IntoSingleModule -> SirSingleModuleProvider(swiftModuleName = input.name)
diff --git a/plugins/parcelize/parcelize-compiler/parcelize.backend/src/org/jetbrains/kotlin/parcelize/IrParcelSerializers.kt b/plugins/parcelize/parcelize-compiler/parcelize.backend/src/org/jetbrains/kotlin/parcelize/IrParcelSerializers.kt
index 795066d..86d6196 100644
--- a/plugins/parcelize/parcelize-compiler/parcelize.backend/src/org/jetbrains/kotlin/parcelize/IrParcelSerializers.kt
+++ b/plugins/parcelize/parcelize-compiler/parcelize.backend/src/org/jetbrains/kotlin/parcelize/IrParcelSerializers.kt
@@ -500,7 +500,9 @@
override fun AndroidIrBuilder.readParcel(parcel: IrValueDeclaration): IrExpression {
return irBlock {
- val (constructorSymbol, addSymbol) = listSymbols(androidSymbols)
+ val initializer = listSymbols(androidSymbols)
+ val constructorSymbol = initializer.constructor
+ val addSymbol = initializer.function
val sizeTemporary = irTemporary(parcelReadInt(irGet(parcel)))
val list = irTemporary(irCall(constructorSymbol).apply {
if (constructorSymbol.owner.valueParameters.isNotEmpty())
@@ -610,7 +612,9 @@
override fun AndroidIrBuilder.readParcel(parcel: IrValueDeclaration): IrExpression {
return irBlock {
- val (constructorSymbol, putSymbol) = mapSymbols(androidSymbols)
+ val initializer = mapSymbols(androidSymbols)
+ val constructorSymbol = initializer.constructor
+ val putSymbol = initializer.function
val sizeTemporary = irTemporary(parcelReadInt(irGet(parcel)))
val map = irTemporary(irCall(constructorSymbol).apply {
if (constructorSymbol.owner.valueParameters.isNotEmpty())
diff --git a/plugins/parcelize/parcelize-compiler/parcelize.k1/src/org/jetbrains/kotlin/parcelize/ParcelizeDeclarationChecker.kt b/plugins/parcelize/parcelize-compiler/parcelize.k1/src/org/jetbrains/kotlin/parcelize/ParcelizeDeclarationChecker.kt
index abe0e25..3e1530c 100644
--- a/plugins/parcelize/parcelize-compiler/parcelize.k1/src/org/jetbrains/kotlin/parcelize/ParcelizeDeclarationChecker.kt
+++ b/plugins/parcelize/parcelize-compiler/parcelize.k1/src/org/jetbrains/kotlin/parcelize/ParcelizeDeclarationChecker.kt
@@ -244,7 +244,8 @@
val type = descriptor.type
if (!type.isError) {
val customParcelerTypes =
- (getTypeParcelers(descriptor.annotations) + getTypeParcelers(containerClass.annotations)).map { (mappedType, _) ->
+ (getTypeParcelers(descriptor.annotations) + getTypeParcelers(containerClass.annotations)).map { initializer ->
+ val mappedType = initializer.mappedType
mappedType
}.toSet()
diff --git a/plugins/scripting/scripting-compiler-impl/src/org/jetbrains/kotlin/scripting/definitions/ScriptiDefinitionsFromClasspathDiscoverySource.kt b/plugins/scripting/scripting-compiler-impl/src/org/jetbrains/kotlin/scripting/definitions/ScriptiDefinitionsFromClasspathDiscoverySource.kt
index 92e8d81..d6442cc 100644
--- a/plugins/scripting/scripting-compiler-impl/src/org/jetbrains/kotlin/scripting/definitions/ScriptiDefinitionsFromClasspathDiscoverySource.kt
+++ b/plugins/scripting/scripting-compiler-impl/src/org/jetbrains/kotlin/scripting/definitions/ScriptiDefinitionsFromClasspathDiscoverySource.kt
@@ -90,13 +90,14 @@
SCRIPT_DEFINITION_MARKERS_EXTENSION_WITH_DOT
)
}.toList()
- val (loadedDefinitions, notFoundClasses) =
- definitionNames.partitionLoadJarDefinitions(
- jar,
- classpathWithLoader,
- hostConfiguration,
- messageReporter
- )
+ val initializer = definitionNames.partitionLoadJarDefinitions(
+ jar,
+ classpathWithLoader,
+ hostConfiguration,
+ messageReporter
+ )
+ val loadedDefinitions = initializer.loaded
+ val notFoundClasses = initializer.notFound
if (notFoundClasses.isNotEmpty()) {
messageReporter(
ScriptDiagnostic.Severity.WARNING,
@@ -113,11 +114,13 @@
defferedDirDependencies.add(dep) // there is no way to know that the dependency is fully "used" so we add it to the list anyway
val discoveryMarkers = File(dep, SCRIPT_DEFINITION_MARKERS_PATH).listFiles()
if (discoveryMarkers?.isEmpty() == false) {
- val (foundDefinitionClasses, notFoundDefinitions) = discoveryMarkers.map {
+ val initializer = discoveryMarkers.map {
it.name.removeSuffix(
SCRIPT_DEFINITION_MARKERS_EXTENSION_WITH_DOT
)
}.partitionLoadDirDefinitions(dep, classpathWithLoader, hostConfiguration, messageReporter)
+ val foundDefinitionClasses = initializer.loaded
+ val notFoundDefinitions = initializer.notFound
foundDefinitionClasses.forEach {
yield(it)
}
@@ -139,8 +142,10 @@
for (dep in defferedDirDependencies) {
if (remainingDefinitionCandidates.isEmpty()) break
try {
- val (foundDefinitionClasses, notFoundDefinitions) =
+ val initializer =
remainingDefinitionCandidates.partitionLoadDirDefinitions(dep, classpathWithLoader, hostConfiguration, messageReporter)
+ val foundDefinitionClasses = initializer.loaded
+ val notFoundDefinitions = initializer.notFound
foundDefinitionClasses.forEach {
yield(it)
}
@@ -191,7 +196,7 @@
if (remainingTemplates.isEmpty()) break
try {
- val (loadedDefinitions, notFoundTemplates) = when {
+ val initializer = when {
dep.isFile && dep.extension == "jar" -> { // checking for extension is the compiler current behaviour, so the same logic is implemented here
JarFile(dep).use { jar ->
remainingTemplates.partitionLoadJarDefinitions(jar, classpathWithLoader, hostConfiguration, messageReporter)
@@ -209,6 +214,8 @@
)
}
}
+ val loadedDefinitions = initializer.loaded
+ val notFoundTemplates = initializer.notFound
if (loadedDefinitions.isNotEmpty()) {
loadedDefinitions.forEach {
yield(it)
diff --git a/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/extensions/ScriptingCollectAdditionalSourcesExtension.kt b/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/extensions/ScriptingCollectAdditionalSourcesExtension.kt
index bc02e37..83a06c6 100644
--- a/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/extensions/ScriptingCollectAdditionalSourcesExtension.kt
+++ b/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/extensions/ScriptingCollectAdditionalSourcesExtension.kt
@@ -19,11 +19,13 @@
configuration: CompilerConfiguration,
project: Project
): Collection<KtFile> {
- val (newSourcesClasspath, newSources, _) = collectScriptsCompilationDependencies(
+ val initializer = collectScriptsCompilationDependencies(
configuration,
project,
knownSources
)
+ val newSourcesClasspath = initializer.classpath
+ val newSources = initializer.sources
configuration.addJvmClasspathRoots(newSourcesClasspath)
return newSources
}
diff --git a/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/impl/KJvmReplCompilerBase.kt b/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/impl/KJvmReplCompilerBase.kt
index 25f55d7..a5ad473 100644
--- a/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/impl/KJvmReplCompilerBase.kt
+++ b/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/impl/KJvmReplCompilerBase.kt
@@ -75,12 +75,15 @@
updateResolutionFilterWithHistory(configuration)
- val (context, errorHolder, snippetKtFile) = prepareForAnalyze(
+ val initializer = prepareForAnalyze(
snippet,
messageCollector,
compilationState,
failOnSyntaxErrors = true
).valueOr { return@withMessageCollector it }
+ val context = initializer.context
+ val errorHolder = initializer.errorHolder
+ val snippetKtFile = initializer.snippetKtFile
val (sourceFiles, sourceDependencies) = collectRefinedSourcesAndUpdateEnvironment(
context,
diff --git a/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/impl/compilationContext.kt b/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/impl/compilationContext.kt
index 10c9059..0b0ba10 100644
--- a/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/impl/compilationContext.kt
+++ b/plugins/scripting/scripting-compiler/src/org/jetbrains/kotlin/scripting/compiler/plugin/impl/compilationContext.kt
@@ -327,13 +327,15 @@
messageCollector: ScriptDiagnosticsMessageCollector
): Pair<List<KtFile>, List<ScriptsCompilationDependencies.SourceDependencies>> {
val sourceFiles = arrayListOf(mainKtFile)
- val (classpath, newSources, sourceDependencies) =
- collectScriptsCompilationDependencies(
- context.environment.configuration,
- context.environment.project,
- sourceFiles,
- initialConfiguration
- )
+ val initializer = collectScriptsCompilationDependencies(
+ context.environment.configuration,
+ context.environment.project,
+ sourceFiles,
+ initialConfiguration
+ )
+ val classpath = initializer.classpath
+ val newSources = initializer.sources
+ val sourceDependencies = initializer.sourceDependencies
context.environment.updateClasspath(classpath.map(::JvmClasspathRoot))
diff --git a/plugins/scripting/scripting-ide-services/src/org/jetbrains/kotlin/scripting/ide_services/compiler/KJvmReplCompilerWithIdeServices.kt b/plugins/scripting/scripting-ide-services/src/org/jetbrains/kotlin/scripting/ide_services/compiler/KJvmReplCompilerWithIdeServices.kt
index f9a4723..0688798 100644
--- a/plugins/scripting/scripting-ide-services/src/org/jetbrains/kotlin/scripting/ide_services/compiler/KJvmReplCompilerWithIdeServices.kt
+++ b/plugins/scripting/scripting-ide-services/src/org/jetbrains/kotlin/scripting/ide_services/compiler/KJvmReplCompilerWithIdeServices.kt
@@ -119,28 +119,32 @@
updateResolutionFilterWithHistory(configuration)
- val (_, errorHolder, snippetKtFile) = prepareForAnalyze(
+ val initializer = prepareForAnalyze(
newSnippet,
messageCollector,
compilationState,
failOnSyntaxErrors = false
).valueOr { return it }
+ val errorHolder = initializer.errorHolder
+ val snippetKtFile = initializer.snippetKtFile
val analyzerEngine = compilationState.analyzerEngine as IdeLikeReplCodeAnalyzer
val analysisResult =
analyzerEngine.statelessAnalyzeWithImportedScripts(snippetKtFile, emptyList(), state.getNextLineNo() + 1)
AnalyzerWithCompilerReport.reportDiagnostics(analysisResult.diagnostics, errorHolder, renderDiagnosticName = false)
- val (_, bindingContext, resolutionFacade, moduleDescriptor, resultProperty) = when (analysisResult) {
+ val initializer2 = when (analysisResult) {
is IdeLikeReplCodeAnalyzer.ReplLineAnalysisResultWithStateless.Stateless -> {
analysisResult
}
else -> return failure(
- newSnippet,
- messageCollector,
- "Unexpected result ${analysisResult::class.java}"
+ newSnippet, messageCollector, "Unexpected result ${analysisResult::class.java}"
)
}
+ val bindingContext = initializer2.bindingContext
+ val resolutionFacade = initializer2.resolutionFacade
+ val moduleDescriptor = initializer2.moduleDescriptor
+ val resultProperty = initializer2.resultProperty
return AnalyzeWithCursorResult(
snippetKtFile, bindingContext, resolutionFacade, moduleDescriptor, cursorAbs, resultProperty
diff --git a/plugins/scripting/scripting-ide-services/src/org/jetbrains/kotlin/scripting/ide_services/compiler/impl/KJvmReplCompleter.kt b/plugins/scripting/scripting-ide-services/src/org/jetbrains/kotlin/scripting/ide_services/compiler/impl/KJvmReplCompleter.kt
index ebf2919..0d78d56 100644
--- a/plugins/scripting/scripting-ide-services/src/org/jetbrains/kotlin/scripting/ide_services/compiler/impl/KJvmReplCompleter.kt
+++ b/plugins/scripting/scripting-ide-services/src/org/jetbrains/kotlin/scripting/ide_services/compiler/impl/KJvmReplCompleter.kt
@@ -275,7 +275,11 @@
}
.forEach { resultTriple ->
val descriptor = resultTriple.first
- val (rawName, presentableText, tailText, completionText) = resultTriple.second
+ val initializer = resultTriple.second
+ val rawName = initializer.rawName
+ val presentableText = initializer.presentableText
+ val tailText = initializer.tailText
+ val completionText = initializer.completionText
if (options.nameFilter(rawName, prefix)) {
val fullName: String =
formatName(
diff --git a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/modularized-test-configurations.gradle.kts b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/modularized-test-configurations.gradle.kts
index 447d93c..c49be9e 100644
--- a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/modularized-test-configurations.gradle.kts
+++ b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/modularized-test-configurations.gradle.kts
@@ -145,7 +145,10 @@
val generateMT = kotlinBuildProperties.generateModularizedConfigurations
val generateFP = kotlinBuildProperties.generateFullPipelineConfigurations
-for ((path, projectName, additionalParameters) in testDataPathList) {
+for (initializer in testDataPathList) {
+ val path = initializer.path
+ val projectName = initializer.name
+ val additionalParameters = initializer.additionalParameters
rootProject.afterEvaluate {
val configurations = mutableListOf<Pair<String, String?>>(
"Full $projectName" to null