diff --git a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/session/ComponentsContainers.kt b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/session/ComponentsContainers.kt index c7bce3d24cd..5542c37dd01 100644 --- a/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/session/ComponentsContainers.kt +++ b/compiler/fir/entrypoint/src/org/jetbrains/kotlin/fir/session/ComponentsContainers.kt @@ -24,12 +24,12 @@ import org.jetbrains.kotlin.fir.deserialization.JvmDeserializedClassConfigurator import org.jetbrains.kotlin.fir.extensions.* import org.jetbrains.kotlin.fir.java.FirJavaVisibilityChecker import org.jetbrains.kotlin.fir.java.FirJvmDefaultModeComponent +import org.jetbrains.kotlin.fir.java.FirSyntheticPropertiesStorage import org.jetbrains.kotlin.fir.java.JvmSupertypeUpdater import org.jetbrains.kotlin.fir.java.enhancement.FirAnnotationTypeQualifierResolver import org.jetbrains.kotlin.fir.java.enhancement.FirEnhancedSymbolsStorage -import org.jetbrains.kotlin.fir.java.scopes.JavaOverridabilityRules -import org.jetbrains.kotlin.fir.java.FirSyntheticPropertiesStorage import org.jetbrains.kotlin.fir.java.enhancement.JavaCompilerRequiredAnnotationEnhancementProvider +import org.jetbrains.kotlin.fir.java.scopes.JavaOverridabilityRules import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.calls.ConeCallConflictResolverFactory import org.jetbrains.kotlin.fir.resolve.calls.FirSyntheticNamesProvider @@ -39,7 +39,7 @@ import org.jetbrains.kotlin.fir.resolve.providers.impl.FirQualifierResolverImpl import org.jetbrains.kotlin.fir.resolve.providers.impl.FirTypeResolverImpl import org.jetbrains.kotlin.fir.resolve.transformers.FirDummyCompilerLazyDeclarationResolver import org.jetbrains.kotlin.fir.resolve.transformers.PlatformSupertypeUpdater -import org.jetbrains.kotlin.fir.resolve.transformers.plugin.GeneratedClassIndex +import org.jetbrains.kotlin.fir.resolve.transformers.plugin.CompilerRequiredAnnotationEnhancementProvider import org.jetbrains.kotlin.fir.scopes.FirOverrideChecker import org.jetbrains.kotlin.fir.scopes.FirOverrideService import org.jetbrains.kotlin.fir.scopes.FirPlatformClassMapper @@ -54,7 +54,6 @@ import org.jetbrains.kotlin.fir.types.TypeComponents import org.jetbrains.kotlin.incremental.components.EnumWhenTracker import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleResolver -import org.jetbrains.kotlin.fir.resolve.transformers.plugin.CompilerRequiredAnnotationEnhancementProvider // -------------------------- Required components -------------------------- @@ -69,7 +68,6 @@ fun FirSession.registerCommonComponents(languageVersionSettings: LanguageVersion register(FirDefaultParametersResolver::class, FirDefaultParametersResolver()) register(FirExtensionService::class, FirExtensionService(this)) - register(GeneratedClassIndex::class, GeneratedClassIndex.create()) register(FirSubstitutionOverrideStorage::class, FirSubstitutionOverrideStorage(this)) register(FirIntersectionOverrideStorage::class, FirIntersectionOverrideStorage(this)) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CheckerSink.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CheckerSink.kt index 812106efe59..4124f5086c5 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CheckerSink.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CheckerSink.kt @@ -6,8 +6,6 @@ package org.jetbrains.kotlin.fir.resolve.calls import org.jetbrains.kotlin.fir.PrivateForInline -import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability -import org.jetbrains.kotlin.resolve.calls.tower.isSuccess import kotlin.coroutines.Continuation abstract class CheckerSink { @@ -50,8 +48,3 @@ class CheckerSinkImpl( get() = stopOnFirstError && !candidate.isSuccessful } -fun CheckerSink.reportDiagnosticIfNotNull(diagnostic: ResolutionDiagnostic?) { - if (diagnostic != null) { - reportDiagnostic(diagnostic) - } -} diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/FirArgumentsToParametersMapper.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/FirArgumentsToParametersMapper.kt index ab23ecf9dad..9110dbc8b7e 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/FirArgumentsToParametersMapper.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/FirArgumentsToParametersMapper.kt @@ -243,7 +243,7 @@ private class FirCallArgumentsProcessor( val parameter = findParameterByName(argument) ?: return result[parameter]?.let { - addDiagnostic(ArgumentPassedTwice(argument, parameter, it)) + addDiagnostic(ArgumentPassedTwice(argument, parameter)) return } @@ -349,7 +349,7 @@ private class FirCallArgumentsProcessor( val someName = someParameter?.name if (someName != null && someName != argument.name) { addDiagnostic( - NameForAmbiguousParameter(argument, matchedParameter = parameter!!, someParameter) + NameForAmbiguousParameter(argument) ) return ProcessorAction.STOP } @@ -375,7 +375,7 @@ private class FirCallArgumentsProcessor( val someParameter = allowedParameters?.getOrNull(matchedIndex)?.fir if (someParameter != null) { addDiagnostic( - NameForAmbiguousParameter(argument, matchedParameter = parameter!!, anotherParameter = someParameter) + NameForAmbiguousParameter(argument) ) ProcessorAction.STOP } else { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevelHandler.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevelHandler.kt index 433505c27ca..6cfd31f881d 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevelHandler.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevelHandler.kt @@ -6,12 +6,13 @@ package org.jetbrains.kotlin.fir.resolve.calls.tower import org.jetbrains.kotlin.fir.expressions.FirExpression -import org.jetbrains.kotlin.fir.resolve.calls.* +import org.jetbrains.kotlin.fir.resolve.calls.CallInfo +import org.jetbrains.kotlin.fir.resolve.calls.CallKind +import org.jetbrains.kotlin.fir.resolve.calls.CandidateCollector +import org.jetbrains.kotlin.fir.resolve.calls.CandidateFactory import org.jetbrains.kotlin.fir.scopes.FirScope import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol -import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind -import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability internal class CandidateFactoriesAndCollectors( // Common calls @@ -98,8 +99,4 @@ private class TowerScopeLevelProcessor( ), candidateFactory.context ) } - - companion object { - val defaultPackage = Name.identifier("kotlin") - } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt index 4c87ad12e37..e3decd2e715 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt @@ -1228,6 +1228,4 @@ abstract class FirDataFlowAnalyzer( private fun MutableFlow.commitOperationStatement(statement: OperationStatement) = addAllStatements(logicSystem.approveOperationStatement(this, statement, removeApprovedOrImpossible = true)) - private fun VariableStorageImpl.getOrCreateIfRealAndUnchanged(originalFlow: PersistentFlow, currentFlow: MutableFlow, fir: FirElement) = - getOrCreateIfReal(originalFlow, fir)?.takeIf { !it.isReal() || logicSystem.isSameValueIn(originalFlow, currentFlow, it) } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirProviderImpl.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirProviderImpl.kt index 085f4470741..12f74d92d9f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirProviderImpl.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirProviderImpl.kt @@ -100,13 +100,6 @@ class FirProviderImpl(val session: FirSession, val kotlinScopeProvider: FirKotli } } - private val FirDeclaration.file: FirFile - get() = when (this) { - is FirFile -> this - is FirRegularClass -> getFirClassifierContainerFile(this.symbol.classId) - else -> error("Should not be here") - } - private fun recordFile(file: FirFile, state: State) { val packageName = file.packageFqName state.fileMap.merge(packageName, listOf(file)) { a, b -> a + b } @@ -321,9 +314,6 @@ class FirProviderImpl(val session: FirSession, val kotlinScopeProvider: FirKotli return state.classesInPackage[fqName] ?: emptySet() } - fun getAllFirFiles(): List { - return state.fileMap.values.flatten() - } } private const val rebuildIndex = true diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/IntegerLiteralAndOperatorApproximationTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/IntegerLiteralAndOperatorApproximationTransformer.kt index e51bccf8302..8b185f6b12a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/IntegerLiteralAndOperatorApproximationTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/IntegerLiteralAndOperatorApproximationTransformer.kt @@ -11,7 +11,6 @@ import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.expressions.FirConstExpression -import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirIntegerLiteralOperatorCall import org.jetbrains.kotlin.fir.expressions.FirStatement import org.jetbrains.kotlin.fir.expressions.builder.buildFunctionCall @@ -31,14 +30,9 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.impl.FirImplicitBuiltinTypeRef import org.jetbrains.kotlin.fir.visitors.FirTransformer -import org.jetbrains.kotlin.fir.visitors.transformSingle import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.types.ConstantValueKind -fun IntegerLiteralAndOperatorApproximationTransformer.approximateIfIsIntegerConst(expression: FirExpression, expectedType: ConeKotlinType? = null): FirExpression { - return expression.transformSingle(this, expectedType) -} - class IntegerLiteralAndOperatorApproximationTransformer( val session: FirSession, val scopeSession: ScopeSession diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt index 15416314263..8c82defdda0 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt @@ -91,12 +91,6 @@ open class FirDeclarationsResolveTransformer( } } - protected fun createTypeParameterScope(declaration: FirMemberDeclaration): FirMemberTypeParameterScope? { - if (declaration.typeParameters.isEmpty()) return null - doTransformTypeParameters(declaration) - return FirMemberTypeParameterScope(declaration) - } - protected fun doTransformTypeParameters(declaration: FirMemberDeclaration) { for (typeParameter in declaration.typeParameters) { typeParameter.transformChildren(transformer, ResolutionMode.ContextIndependent) @@ -210,14 +204,6 @@ open class FirDeclarationsResolveTransformer( } } - fun FirProperty.getDefaultAccessorStatus(): FirDeclarationStatus { - // Downward propagation of `inline` and `external` modifiers (from property to its accessors) - return FirDeclarationStatusImpl(this.visibility, this.modality).apply { - isInline = this@getDefaultAccessorStatus.isInline - isExternal = this@getDefaultAccessorStatus.isExternal - } - } - override fun transformField(field: FirField, data: ResolutionMode): FirField = whileAnalysing(session, field) { val returnTypeRef = field.returnTypeRef if (implicitTypeOnly) return field diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirContractsDslNames.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirContractsDslNames.kt index 6878e8bccae..e242e881ba2 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirContractsDslNames.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirContractsDslNames.kt @@ -10,16 +10,8 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name object FirContractsDslNames { - // Internal marker-annotation for distinguishing our API - val CONTRACTS_DSL_ANNOTATION_FQN = id("kotlin.internal", "ContractsDsl") - // Types - val EFFECT = id("Effect") - val CONDITIONAL_EFFECT = id("ConditionalEffect") val SIMPLE_EFFECT = id("SimpleEffect") - val RETURNS_EFFECT = id("Returns") - val RETURNS_NOT_NULL_EFFECT = id("ReturnsNotNull") - val CALLS_IN_PLACE_EFFECT = id("CallsInPlace") // Structure-defining calls val CONTRACT = id("contract") diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompilerRequiredAnnotationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompilerRequiredAnnotationsResolveTransformer.kt index e69cc07db16..05575509a88 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompilerRequiredAnnotationsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompilerRequiredAnnotationsResolveTransformer.kt @@ -90,12 +90,6 @@ abstract class AbstractFirCompilerRequiredAnnotationsResolveTransformer( return file } - fun withFileAndScopes(file: FirFile, f: () -> T): T { - annotationTransformer.withFile(file) { - return annotationTransformer.withFileScopes(file, f) - } - } - override fun transformRegularClass(regularClass: FirRegularClass, data: Nothing?): FirStatement { return annotationTransformer.transformRegularClass(regularClass, null) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/GeneratedClassIndex.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/GeneratedClassIndex.kt deleted file mode 100644 index 96173218155..00000000000 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/GeneratedClassIndex.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.resolve.transformers.plugin - -import com.google.common.collect.ArrayListMultimap -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.FirSessionComponent -import org.jetbrains.kotlin.fir.ThreadSafeMutableState -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin -import org.jetbrains.kotlin.GeneratedDeclarationKey -import org.jetbrains.kotlin.fir.declarations.FirRegularClass - -data class GeneratedClass(val klass: FirRegularClass, val owner: FirDeclaration) - -abstract class GeneratedClassIndex : FirSessionComponent { - companion object { - fun create(): GeneratedClassIndex { - return GeneratedClassIndexImpl() - } - } - - abstract fun registerClass(klass: FirRegularClass, owner: FirDeclaration) - abstract operator fun get(key: GeneratedDeclarationKey): List -} - -val FirSession.generatedClassIndex: GeneratedClassIndex by FirSession.sessionComponentAccessor() - -@ThreadSafeMutableState -private class GeneratedClassIndexImpl : GeneratedClassIndex() { - private val index: ArrayListMultimap = ArrayListMultimap.create() - - override fun registerClass(klass: FirRegularClass, owner: FirDeclaration) { - val key = (klass.origin as FirDeclarationOrigin.Plugin).key - index.put(key, GeneratedClass(klass, owner)) - } - - override fun get(key: GeneratedDeclarationKey): List { - return index.get(key) - } -} diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt index 51607ffbc56..e91fcb52cd1 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt @@ -50,8 +50,7 @@ class NamedArgumentNotAllowed( class ArgumentPassedTwice( override val argument: FirExpression, - val valueParameter: FirValueParameter, - val firstOccurrence: ResolvedCallArgument + val valueParameter: FirValueParameter ) : InapplicableArgumentDiagnostic() class VarargArgumentOutsideParentheses( @@ -72,9 +71,7 @@ class NameNotFound( ) : ResolutionDiagnostic(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR) class NameForAmbiguousParameter( - val argument: FirNamedArgumentExpression, - val matchedParameter: FirValueParameter, - val anotherParameter: FirValueParameter + val argument: FirNamedArgumentExpression ) : ResolutionDiagnostic(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR) object InapplicableCandidate : ResolutionDiagnostic(INAPPLICABLE) diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/LogicSystem.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/LogicSystem.kt index c75e6a88e75..c49c396d1b4 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/LogicSystem.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/LogicSystem.kt @@ -102,9 +102,6 @@ abstract class LogicSystem(private val context: ConeInferenceContext) { flow.assignmentIndex[variable] = index } - fun isSameValueIn(a: PersistentFlow, b: MutableFlow, variable: RealVariable): Boolean = - a.assignmentIndex[variable] == b.assignmentIndex[variable] - fun isSameValueIn(a: PersistentFlow, b: PersistentFlow, variable: RealVariable): Boolean = a.assignmentIndex[variable] == b.assignmentIndex[variable] diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/Stack.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/Stack.kt index 3a47c9e52e5..1045cbc8823 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/Stack.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/Stack.kt @@ -22,7 +22,6 @@ fun stackOf(vararg values: T): Stack = StackImpl(*values) val Stack<*>.isEmpty: Boolean get() = size == 0 val Stack<*>.isNotEmpty: Boolean get() = size != 0 fun Stack.topOrNull(): T? = if (size == 0) null else top() -fun Stack.popOrNull(): T? = if (size == 0) null else pop() private class StackImpl(vararg values: T) : Stack() { private val stack = mutableListOf(*values) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirGeneration.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirGeneration.kt index 3e383973f01..c9b31c9a753 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirGeneration.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirGeneration.kt @@ -66,18 +66,3 @@ fun generateTemporaryVariable( } } -fun generateTemporaryVariable( - moduleData: FirModuleData, - source: KtSourceElement?, - specialName: String, - initializer: FirExpression, - extractedAnnotations: Collection? = null, -): FirProperty = - generateTemporaryVariable( - moduleData, - source, - Name.special("<$specialName>"), - initializer, - null, - extractedAnnotations, - ) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirLanguageSettingsComponent.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirLanguageSettingsComponent.kt index bd75455f463..0e8007d9461 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirLanguageSettingsComponent.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirLanguageSettingsComponent.kt @@ -12,10 +12,6 @@ class FirLanguageSettingsComponent(val languageVersionSettings: LanguageVersionS private val FirSession.languageSettingsComponent: FirLanguageSettingsComponent by FirSession.sessionComponentAccessor() -private val FirSession.safeLanguageSettingsComponent: FirLanguageSettingsComponent? by FirSession.nullableSessionComponentAccessor() - val FirSession.languageVersionSettings: LanguageVersionSettings get() = languageSettingsComponent.languageVersionSettings -val FirSession.safeLanguageVersionSettings: LanguageVersionSettings? - get() = safeLanguageSettingsComponent?.languageVersionSettings \ No newline at end of file diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSession.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSession.kt index 4244bacb09f..06c27d2d8ae 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSession.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSession.kt @@ -77,7 +77,6 @@ class BuiltinTypes { val floatType: FirImplicitBuiltinTypeRef = FirImplicitFloatTypeRef(null) val uIntType: FirImplicitUIntTypeRef = FirImplicitUIntTypeRef(null) - val uLongType: FirImplicitULongTypeRef = FirImplicitULongTypeRef(null) val nothingType: FirImplicitBuiltinTypeRef = FirImplicitNothingTypeRef(null) val nullableNothingType: FirImplicitBuiltinTypeRef = FirImplicitNullableNothingTypeRef(null) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/caches/FirCachesFactory.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/caches/FirCachesFactory.kt index 276a50050d1..41cc8d705b0 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/caches/FirCachesFactory.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/caches/FirCachesFactory.kt @@ -70,28 +70,4 @@ inline fun FirCachesFactory.createCache( createValue = { key, _ -> createValue(key) }, ) -inline fun FirCachesFactory.createCacheWithPostCompute( - crossinline createValue: (K, CONTEXT) -> V, - crossinline postCompute: (K, V) -> Unit -): FirCache = createCacheWithPostCompute( - createValue = { key, context -> createValue(key, context) to null }, - postCompute = { key, value, _ -> postCompute(key, value) } -) - -inline fun FirCachesFactory.createCacheWithPostCompute( - crossinline createValue: (K) -> V, - crossinline postCompute: (K, V) -> Unit -): FirCache = createCacheWithPostCompute( - createValue = { key, _ -> createValue(key) to null }, - postCompute = { key, value, _ -> postCompute(key, value) } -) - -inline fun FirCachesFactory.createCacheWithPostCompute( - crossinline createValue: (K) -> Pair, - crossinline postCompute: (K, V, DATA) -> Unit -): FirCache = createCacheWithPostCompute( - createValue = { key, _ -> createValue(key) }, - postCompute = { key, value, data -> postCompute(key, value, data) } -) - diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirResolvePhase.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirResolvePhase.kt index 1ba9d4c0aa2..08ae67adae8 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirResolvePhase.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirResolvePhase.kt @@ -21,15 +21,6 @@ enum class FirResolvePhase(val noProcessor: Boolean = false) { ANNOTATIONS_ARGUMENTS_MAPPING, BODY_RESOLVE; - val requiredToLaunch: FirResolvePhase - get() = when (this) { - RAW_FIR -> RAW_FIR - IMPORTS -> RAW_FIR - STATUS -> TYPES - IMPLICIT_TYPES_BODY_RESOLVE, BODY_RESOLVE -> STATUS - else -> values()[ordinal - 1] - } - val next: FirResolvePhase get() = values()[ordinal + 1] val previous: FirResolvePhase get() = values()[ordinal - 1] diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/SupertypesComputationStatus.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/SupertypesComputationStatus.kt deleted file mode 100644 index 18f0d5197ee..00000000000 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/SupertypesComputationStatus.kt +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.declarations - -enum class SupertypesComputationStatus { - NOT_COMPUTED, COMPUTING, COMPUTED -} \ No newline at end of file diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/deprecations.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/deprecations.kt index 33f67c5f165..04df51fe061 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/deprecations.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/deprecations.kt @@ -1,9 +1,7 @@ package org.jetbrains.kotlin.fir.declarations -import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget -import org.jetbrains.kotlin.utils.keysToMap -import org.jetbrains.kotlin.utils.keysToMapExceptNulls +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo /* * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. @@ -27,59 +25,9 @@ class DeprecationsPerUseSite( fun isEmpty(): Boolean = all == null && bySpecificSite == null fun isNotEmpty(): Boolean = !isEmpty() - fun combineMin(other: DeprecationsPerUseSite): DeprecationsPerUseSite { - if (isEmpty() || isEmpty()) return EmptyDeprecationsPerUseSite - - return DeprecationsPerUseSite( - if (all == null || other.all == null) null else minOf(all, other.all), - if (bySpecificSite == null || other.bySpecificSite == null) { - null - } else { - bySpecificSite.keys.intersect(other.bySpecificSite.keys).keysToMap { target -> - minOf(bySpecificSite[target]!!, other.bySpecificSite[target]!!) - } - } - - ) - } - - fun combinePreferLeft(other: DeprecationsPerUseSite): DeprecationsPerUseSite { - return DeprecationsPerUseSite( - all ?: other.all, - if (bySpecificSite == null || other.bySpecificSite == null) { - bySpecificSite ?: other.bySpecificSite - } else { - bySpecificSite.keys.union(other.bySpecificSite.keys).keysToMapExceptNulls { target -> - bySpecificSite[target] ?: other.bySpecificSite[target] - } - } - - ) - } - - fun inheritableOnly(): DeprecationsPerUseSite = - DeprecationsPerUseSite( - all?.takeIf { it.propagatesToOverrides }, - bySpecificSite?.filterValues { it.propagatesToOverrides } - ) - override fun toString(): String = if (isEmpty()) "NoDeprecation" else "org.jetbrains.kotlin.fir.declarations.DeprecationInfoForUseSites(all=$all, bySpecificSite=$bySpecificSite)" - - companion object { - fun fromMap(perUseSite: Map): DeprecationsPerUseSite { - if (perUseSite.isEmpty()) return EmptyDeprecationsPerUseSite - - @Suppress("UNCHECKED_CAST") - val specificCallSite = perUseSite.filterKeys { it != null } as Map - return DeprecationsPerUseSite( - perUseSite[null], - specificCallSite.takeIf { it.isNotEmpty() } - ) - } - } - } val EmptyDeprecationsPerUseSite = DeprecationsPerUseSite(null, null) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/utils/FirDeclarationUtil.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/utils/FirDeclarationUtil.kt index ce901bf3a1c..d736eb5a260 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/utils/FirDeclarationUtil.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/utils/FirDeclarationUtil.kt @@ -29,8 +29,6 @@ val FirClass.delegateFields: List inline val FirDeclaration.isJava: Boolean get() = origin is FirDeclarationOrigin.Java -inline val FirDeclaration.isJavaSource: Boolean - get() = origin == FirDeclarationOrigin.Java.Source inline val FirDeclaration.isFromLibrary: Boolean get() = origin == FirDeclarationOrigin.Library || origin == FirDeclarationOrigin.Java.Library inline val FirDeclaration.isPrecompiled: Boolean diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/utils/FirSymbolStatusUtils.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/utils/FirSymbolStatusUtils.kt index 7472b006550..335d7f46e85 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/utils/FirSymbolStatusUtils.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/utils/FirSymbolStatusUtils.kt @@ -97,8 +97,4 @@ inline val FirClassSymbol<*>.isEnumEntry: Boolean // ---------------------- specific callables ---------------------- -inline val FirPropertyAccessorSymbol.allowsToHaveFakeOverride: Boolean get() = visibility.allowsToHaveFakeOverride - -inline val FirPropertySymbol.allowsToHaveFakeOverride: Boolean get() = visibility.allowsToHaveFakeOverride - inline val FirNamedFunctionSymbol.isLocal: Boolean get() = rawStatus.visibility == Visibilities.Local diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirArgumentUtil.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirArgumentUtil.kt index deefcdf94b4..bd390be7c63 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirArgumentUtil.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirArgumentUtil.kt @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.fir.expressions import org.jetbrains.kotlin.KtSourceElement import org.jetbrains.kotlin.fir.declarations.FirValueParameter import org.jetbrains.kotlin.fir.expressions.builder.buildArgumentList -import org.jetbrains.kotlin.fir.expressions.impl.FirArraySetArgumentList import org.jetbrains.kotlin.fir.expressions.impl.FirResolvedArgumentList import org.jetbrains.kotlin.fir.expressions.impl.FirResolvedArgumentListForErrorCall import org.jetbrains.kotlin.fir.expressions.impl.FirResolvedArgumentListImpl @@ -22,9 +21,6 @@ fun buildBinaryArgumentList(left: FirExpression, right: FirExpression): FirArgum arguments += right } -fun buildArraySetArgumentList(rValue: FirExpression, indexes: List): FirArgumentList = - FirArraySetArgumentList(rValue, indexes) - fun buildResolvedArgumentList( mapping: LinkedHashMap, source: KtSourceElement? = null diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirOperation.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirOperation.kt index 3d03504c3cf..2c85b7077e1 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirOperation.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirOperation.kt @@ -27,8 +27,6 @@ enum class FirOperation(val operator: String = "???") { DIV_ASSIGN("/="), REM_ASSIGN("%="), - // Unary - EXCL("!"), // Type IS("is"), NOT_IS("!is"), @@ -40,12 +38,6 @@ enum class FirOperation(val operator: String = "???") { companion object { val ASSIGNMENTS: Set = EnumSet.of(ASSIGN, PLUS_ASSIGN, MINUS_ASSIGN, TIMES_ASSIGN, DIV_ASSIGN, REM_ASSIGN) - val BOOLEANS: Set = EnumSet.of( - EQ, NOT_EQ, IDENTITY, NOT_IDENTITY, LT, GT, LT_EQ, GT_EQ, IS, NOT_IS - ) - - val COMPARISONS: Set = EnumSet.of(LT, GT, LT_EQ, GT_EQ) - val TYPES: Set = EnumSet.of(IS, NOT_IS, AS, SAFE_AS) } } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirAnnotationArgumentMappingBuilder.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirAnnotationArgumentMappingBuilder.kt index 2bfb551440f..f6bccc1e659 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirAnnotationArgumentMappingBuilder.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirAnnotationArgumentMappingBuilder.kt @@ -8,11 +8,9 @@ package org.jetbrains.kotlin.fir.expressions.builder import org.jetbrains.kotlin.KtSourceElement import org.jetbrains.kotlin.fir.builder.FirBuilderDsl import org.jetbrains.kotlin.fir.expressions.FirAnnotationArgumentMapping -import org.jetbrains.kotlin.fir.expressions.FirArgumentList import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.impl.FirAnnotationArgumentMappingImpl import org.jetbrains.kotlin.fir.expressions.impl.FirEmptyAnnotationArgumentMapping -import org.jetbrains.kotlin.fir.expressions.impl.FirResolvedArgumentList import org.jetbrains.kotlin.name.Name import kotlin.contracts.ExperimentalContracts import kotlin.contracts.InvocationKind @@ -36,14 +34,3 @@ inline fun buildAnnotationArgumentMapping(init: FirAnnotationArgumentMappingBuil } return FirAnnotationArgumentMappingBuilder().apply(init).build() } - -fun FirArgumentList.toAnnotationArgumentMapping(): FirAnnotationArgumentMapping { - return buildAnnotationArgumentMapping { - source = this@toAnnotationArgumentMapping.source - if (this@toAnnotationArgumentMapping is FirResolvedArgumentList) { - this@toAnnotationArgumentMapping.mapping - .map { (argument, parameter) -> parameter.name to argument } - .toMap(mapping) - } - } -} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirArraySetArgumentList.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirArraySetArgumentList.kt deleted file mode 100644 index 0826570c907..00000000000 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirArraySetArgumentList.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions.impl - -import org.jetbrains.kotlin.KtSourceElement -import org.jetbrains.kotlin.fir.expressions.FirAbstractArgumentList -import org.jetbrains.kotlin.fir.expressions.FirExpression - -class FirArraySetArgumentList internal constructor( - private val rValue: FirExpression, - private val indexes: List -) : FirAbstractArgumentList() { - override val arguments: List - get() = indexes + rValue - - override val source: KtSourceElement? - get() = null -} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/extensions/FirExtensionService.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/extensions/FirExtensionService.kt index 826029af466..b0990350e2e 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/extensions/FirExtensionService.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/extensions/FirExtensionService.kt @@ -54,6 +54,3 @@ class FirExtensionService(val session: FirSession) : ComponentArrayOwner 0 diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/references/FirReferenceUtils.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/references/FirReferenceUtils.kt index e4fc5de7638..1808591a538 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/references/FirReferenceUtils.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/references/FirReferenceUtils.kt @@ -71,9 +71,3 @@ fun FirReference.isError(): Boolean { } } -fun FirReference.toNameString(): String? = when (this) { - is FirNamedReference -> name.asString() - is FirThisReference -> "this" - is FirSuperReference -> "super" - else -> null -} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt index 4c70379b8c6..2e998fe195e 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/scopes/FirScope.kt @@ -63,15 +63,6 @@ fun FirTypeScope.processOverriddenFunctionsAndSelf( return processOverriddenFunctions(functionSymbol, processor = processor) } -fun FirTypeScope.processOverriddenPropertiesAndSelf( - propertySymbol: FirPropertySymbol, - processor: (FirPropertySymbol) -> ProcessorAction -): ProcessorAction { - if (!processor(propertySymbol)) return ProcessorAction.STOP - - return processOverriddenProperties(propertySymbol, processor = processor) -} - fun List.processOverriddenPropertiesAndSelf( propertySymbol: FirPropertySymbol, processor: (FirPropertySymbol) -> ProcessorAction diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/symbols/impl/FirFunctionSymbol.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/symbols/impl/FirFunctionSymbol.kt index 43193b27f60..5f04d88c879 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/symbols/impl/FirFunctionSymbol.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/symbols/impl/FirFunctionSymbol.kt @@ -70,8 +70,6 @@ class FirConstructorSymbol(callableId: CallableId) : FirFunctionSymbol error("!") } -private fun ConeTypeParameterType.hasNotNullUpperBound(): Boolean { - return lookupTag.typeParameterSymbol.resolvedBounds.any { - val boundType = it.coneType - if (boundType is ConeTypeParameterType) { - boundType.hasNotNullUpperBound() - } else { - boundType.nullability == ConeNullability.NOT_NULL - } - } -} - val FirTypeRef.canBeNull: Boolean get() = coneType.canBeNull diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/FieldSets.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/FieldSets.kt index aa3d6cd604a..11dc41275f5 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/FieldSets.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/FieldSets.kt @@ -60,8 +60,6 @@ object FieldSets { val typeRefField = field(typeRef, withReplace = true) - val valueParameters by lazy { fieldList(valueParameter) } - val typeParameters by lazy { fieldList("typeParameters", typeParameter) } val typeParameterRefs by lazy { fieldList("typeParameters", typeParameterRef) } diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/Types.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/Types.kt index 06a65453492..bebf477106e 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/Types.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/Types.kt @@ -71,7 +71,6 @@ val firBasedSymbolType = type("fir.symbols", "FirBasedSymbol") val functionSymbolType = type("fir.symbols.impl", "FirFunctionSymbol") val backingFieldSymbolType = type("fir.symbols.impl", "FirBackingFieldSymbol") val delegateFieldSymbolType = type("fir.symbols.impl", "FirDelegateFieldSymbol") -val classSymbolType = type("fir.symbols.impl", "FirClassSymbol") val classLikeSymbolType = type("fir.symbols.impl", "FirClassLikeSymbol<*>") val regularClassSymbolType = type("fir.symbols.impl", "FirRegularClassSymbol") val typeParameterSymbolType = type("fir.symbols.impl", "FirTypeParameterSymbol") @@ -85,7 +84,6 @@ val emptyContractDescriptionType = generatedType("contracts.impl", "FirEmptyCont val coneDiagnosticType = generatedType("diagnostics", "ConeDiagnostic") val coneStubDiagnosticType = generatedType("diagnostics", "ConeStubDiagnostic") -val dslBuilderAnnotationType = generatedType("builder", "FirBuilderDsl") val firImplementationDetailType = generatedType("FirImplementationDetail") val declarationOriginType = generatedType("declarations", "FirDeclarationOrigin") val declarationAttributesType = generatedType("declarations", "FirDeclarationAttributes") diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/context/AbstractBuilderConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/context/AbstractBuilderConfigurator.kt index c32dd704c1e..8657d02aed3 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/context/AbstractBuilderConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/context/AbstractBuilderConfigurator.kt @@ -90,16 +90,6 @@ abstract class AbstractBuilderConfigurator(val firTr builder.materializedElement = element return ExceptConfigurator() } - - inner class Helper(val fieldName: String) { - infix fun from(element: Element) { - val field = element[fieldName] ?: throw IllegalArgumentException("Element $element doesn't have field $fieldName") - builder.fields += FieldWithDefault(field) - } - } - - // fields has from - infix fun has(name: String): Helper = Helper(name) } inner class ExceptConfigurator { @@ -115,12 +105,6 @@ abstract class AbstractBuilderConfigurator(val firTr val fields = Fields() val parents: MutableList get() = builder.parents - var materializedElement: Element - get() = throw IllegalArgumentException() - set(value) { - builder.materializedElement = value - } - } inner class IntermediateBuilderDelegateProvider( diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/context/AbstractFieldConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/context/AbstractFieldConfigurator.kt index 2b5aa4d101b..c83d354e0b9 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/context/AbstractFieldConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/context/AbstractFieldConfigurator.kt @@ -42,10 +42,6 @@ abstract class AbstractFieldConfigurator(private val } } - fun parentArg(parent: Element, argument: String, type: String) { - parentArg(parent, Type(null, argument), Type(null, type)) - } - fun parentArg(parent: Element, argument: String, type: Importable) { parentArg(parent, Type(null, argument), type) } @@ -61,10 +57,6 @@ abstract class AbstractFieldConfigurator(private val argMap[argument] = type } - fun Type.withArgs(vararg args: Importable): Pair> { - return this to args.toList() - } - fun Type.withArgs(vararg args: String): Pair> { return this to args.map { Type(null, it) } } diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/context/AbstractFirTreeImplementationConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/context/AbstractFirTreeImplementationConfigurator.kt index fad9ad1b869..490523f782f 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/context/AbstractFirTreeImplementationConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/context/AbstractFirTreeImplementationConfigurator.kt @@ -87,8 +87,6 @@ abstract class AbstractFirTreeImplementationConfigurator { val parents = ParentsHolder() - fun Implementation.withArg(argument: Importable): ImplementationWithArg = ImplementationWithArg(this, argument) - fun optInToInternals() { implementation.requiresOptIn = true } diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/ElementUtils.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/ElementUtils.kt index 473acabfef3..9254e6eccb6 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/ElementUtils.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/model/ElementUtils.kt @@ -94,6 +94,4 @@ fun Field.withTransform(needTransformInOtherChildren: Boolean = false): Field = fun Field.withReplace(): Field = copy().apply { withReplace = true -} - -fun FieldSet.withTransform(): FieldSet = this.map { it.withTransform() } +} \ No newline at end of file diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/printer/builder.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/printer/builder.kt index 4069e06a08f..d99201d129a 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/printer/builder.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/printer/builder.kt @@ -130,7 +130,6 @@ private fun SmartPrinter.printBuilder(builder: Builder) { internal val Field.invisibleField: Boolean get() = customInitializationCall != null -private val String.nullable: String get() = if (endsWith("?")) this else "$this?" private fun FieldWithDefault.needBackingField(fieldIsUseless: Boolean) = (!nullable || notNull) && origin !is FieldList && if (fieldIsUseless) { defaultValueInImplementation == null diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/util/FieldTableGenerator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/util/FieldTableGenerator.kt deleted file mode 100644 index 24742263760..00000000000 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/util/FieldTableGenerator.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.tree.generator.util - -import org.jetbrains.kotlin.fir.tree.generator.context.AbstractFirTreeBuilder -import org.jetbrains.kotlin.fir.tree.generator.model.Element -import org.jetbrains.kotlin.fir.tree.generator.model.Field -import java.io.File - -fun printFieldUsageTable(builder: AbstractFirTreeBuilder) { - val elements = builder.elements.filter { it.allImplementations.isNotEmpty() } - val fields = elements.flatMapTo(mutableSetOf()) { it.allFields } - - val mapping = mutableMapOf>() - val fieldsCount = mutableMapOf() - for (element in elements) { - val containingFields = mutableSetOf() - for (field in fields) { - if (field in element.allFields) { - containingFields += field - fieldsCount[field] = fieldsCount.getOrDefault(field, 0) + 1 - } - } - mapping[element] = containingFields - } - - val sortedFields = fields.sortedByDescending { fieldsCount[it] } - File("compiler/fir/tree/table.csv").printWriter().use { printer -> - with(printer) { - val delim = "," - print(delim) - println(sortedFields.joinToString(delim) { "${it.name}:${fieldsCount.getValue(it)}" }) - for (element in elements) { - print(element.name + delim) - val containingFields = mapping.getValue(element) - println(sortedFields.joinToString(delim) { if (it in containingFields) "+" else "-" }) - } - } - } -} \ No newline at end of file