Move Fir*SourceElement to frontend.common, rename to Kt* (complete)

This commit is contained in:
Ilya Chernikov
2021-09-17 12:05:37 +02:00
parent c50c8ad270
commit a65beb2dc5
580 changed files with 2031 additions and 1950 deletions
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.fir
import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange
import org.jetbrains.kotlin.descriptors.EffectiveVisibility
import org.jetbrains.kotlin.descriptors.Modality
@@ -32,7 +33,7 @@ fun FirFunctionCall.copy(
explicitReceiver: FirExpression? = this.explicitReceiver,
dispatchReceiver: FirExpression = this.dispatchReceiver,
extensionReceiver: FirExpression = this.extensionReceiver,
source: FirSourceElement? = this.source,
source: KtSourceElement? = this.source,
typeArguments: List<FirTypeProjection> = this.typeArguments,
resultType: FirTypeRef = this.typeRef
): FirFunctionCall {
@@ -79,7 +80,7 @@ inline fun FirFunctionCall.copyAsImplicitInvokeCall(
fun FirAnonymousFunction.copy(
receiverTypeRef: FirTypeRef? = this.receiverTypeRef,
source: FirSourceElement? = this.source,
source: KtSourceElement? = this.source,
moduleData: FirModuleData = this.moduleData,
origin: FirDeclarationOrigin = this.origin,
returnTypeRef: FirTypeRef = this.returnTypeRef,
@@ -5,8 +5,9 @@
package org.jetbrains.kotlin.fir.resolve
import org.jetbrains.kotlin.KtFakeSourceElementKind
import org.jetbrains.kotlin.builtins.StandardNames
import org.jetbrains.kotlin.fir.FirFakeSourceElementKind
import org.jetbrains.kotlin.fakeElement
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
@@ -14,7 +15,6 @@ import org.jetbrains.kotlin.fir.declarations.getAnnotationsByClassId
import org.jetbrains.kotlin.fir.expressions.builder.buildAnnotation
import org.jetbrains.kotlin.fir.expressions.builder.buildAnnotationArgumentMapping
import org.jetbrains.kotlin.fir.expressions.builder.buildConstExpression
import org.jetbrains.kotlin.fir.fakeElement
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
@@ -80,7 +80,7 @@ fun ConeKotlinType.withParameterNameAnnotation(valueParameter: FirValueParameter
// Existing @ParameterName annotation takes precedence
if (attributes.customAnnotations.getAnnotationsByClassId(StandardNames.FqNames.parameterNameClassId).isNotEmpty()) return this
val fakeSource = valueParameter.source?.fakeElement(FirFakeSourceElementKind.ParameterNameAnnotationCall)
val fakeSource = valueParameter.source?.fakeElement(KtFakeSourceElementKind.ParameterNameAnnotationCall)
val parameterNameAnnotationCall = buildAnnotation {
source = fakeSource
annotationTypeRef =
@@ -5,8 +5,8 @@
package org.jetbrains.kotlin.fir.scopes.impl
import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.fir.FirImplementationDetail
import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.fir.types.builder.buildImplicitTypeRef
@OptIn(FirImplementationDetail::class)
class FirIntegerOperatorCall @FirImplementationDetail constructor(
source: FirSourceElement?,
source: KtSourceElement?,
typeRef: FirTypeRef,
annotations: MutableList<FirAnnotation>,
typeArguments: MutableList<FirTypeProjection>,
@@ -49,7 +49,7 @@ class FirIntegerOperatorCall @FirImplementationDetail constructor(
@FirBuilderDsl
class FirIntegerOperatorCallBuilder : FirQualifiedAccessBuilder, FirCallBuilder, FirAnnotationContainerBuilder, FirExpressionBuilder {
override var source: FirSourceElement? = null
override var source: KtSourceElement? = null
override var typeRef: FirTypeRef = buildImplicitTypeRef()
override val annotations: MutableList<FirAnnotation> = mutableListOf()
override val typeArguments: MutableList<FirTypeProjection> = mutableListOf()
@@ -5,14 +5,19 @@
package org.jetbrains.kotlin.fir.types
import org.jetbrains.kotlin.KtFakeSourceElementKind
import org.jetbrains.kotlin.KtSourceElement
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.fir.*
import org.jetbrains.kotlin.fakeElement
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.copyWithNewSourceKind
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.utils.visibility
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap
import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.resolvedTypeFromPrototype
import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLookupTagWithFixedSymbol
@@ -205,7 +210,7 @@ fun ConeKotlinType.toSymbol(session: FirSession): FirBasedSymbol<*>? {
}
fun ConeKotlinType.toFirResolvedTypeRef(
source: FirSourceElement? = null,
source: KtSourceElement? = null,
delegatedTypeRef: FirTypeRef? = null
): FirResolvedTypeRef {
return if (this is ConeKotlinErrorType) {
@@ -256,7 +261,7 @@ fun FirTypeRef.withReplacedReturnType(newType: ConeKotlinType?): FirTypeRef {
fun FirTypeRef.withReplacedConeType(
newType: ConeKotlinType?,
firFakeSourceElementKind: FirFakeSourceElementKind? = null
firFakeSourceElementKind: KtFakeSourceElementKind? = null
): FirResolvedTypeRef {
require(this is FirResolvedTypeRef)
if (newType == null) return this
@@ -352,7 +357,7 @@ private fun FirTypeRef.hideLocalTypeIfNeeded(
val superType = firClass.superTypeRefs.single()
if (superType is FirResolvedTypeRef) {
val newKind = source?.kind
return if (newKind is FirFakeSourceElementKind) superType.copyWithNewSourceKind(newKind) else superType
return if (newKind is KtFakeSourceElementKind) superType.copyWithNewSourceKind(newKind) else superType
}
return this
}