diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index 8d9b1d22aed..32870ee9f78 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -171,17 +171,10 @@ class CallAndReferenceGenerator( return null } val superTypeRef = dispatchReceiverReference.superTypeRef - val coneSuperType = superTypeRef.coneTypeSafe() - if (coneSuperType != null) { - val firClassSymbol = coneSuperType.fullyExpandedType(session).lookupTag.toSymbol(session) as? FirClassSymbol<*> - if (firClassSymbol != null) { - return classifierStorage.getIrClassSymbol(firClassSymbol) - } - } else if (superTypeRef is FirComposedSuperTypeRef) { - val owner = callSymbol?.owner - if (owner != null && owner is IrDeclaration) { - return owner.parentClassOrNull?.symbol - } + val coneSuperType = superTypeRef.coneTypeSafe() ?: return null + val firClassSymbol = coneSuperType.fullyExpandedType(session).lookupTag.toSymbol(session) as? FirClassSymbol<*> + if (firClassSymbol != null) { + return classifierStorage.getIrClassSymbol(firClassSymbol) } return null } diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/FirComposedSuperTypeRef.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/FirComposedSuperTypeRef.kt deleted file mode 100644 index da01644ee59..00000000000 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/FirComposedSuperTypeRef.kt +++ /dev/null @@ -1,25 +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.types - -import org.jetbrains.kotlin.fir.FirSourceElement -import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall -import org.jetbrains.kotlin.fir.visitors.* - -/* - * This file was generated automatically - * DO NOT MODIFY IT MANUALLY - */ - -abstract class FirComposedSuperTypeRef : FirTypeRef() { - abstract override val source: FirSourceElement? - abstract override val annotations: List - abstract val superTypeRefs: List - - override fun accept(visitor: FirVisitor, data: D): R = visitor.visitComposedSuperTypeRef(this, data) - - abstract override fun transformAnnotations(transformer: FirTransformer, data: D): FirComposedSuperTypeRef -} diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/builder/FirComposedSuperTypeRefBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/builder/FirComposedSuperTypeRefBuilder.kt deleted file mode 100644 index 281df8c7dab..00000000000 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/builder/FirComposedSuperTypeRefBuilder.kt +++ /dev/null @@ -1,57 +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.types.builder - -import kotlin.contracts.* -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.FirAnnotationCall -import org.jetbrains.kotlin.fir.types.FirComposedSuperTypeRef -import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef -import org.jetbrains.kotlin.fir.types.impl.FirComposedSuperTypeRefImpl -import org.jetbrains.kotlin.fir.visitors.* - -/* - * This file was generated automatically - * DO NOT MODIFY IT MANUALLY - */ - -@FirBuilderDsl -class FirComposedSuperTypeRefBuilder : FirAnnotationContainerBuilder { - override var source: FirSourceElement? = null - override val annotations: MutableList = mutableListOf() - val superTypeRefs: MutableList = mutableListOf() - - override fun build(): FirComposedSuperTypeRef { - return FirComposedSuperTypeRefImpl( - source, - annotations, - superTypeRefs, - ) - } - -} - -@OptIn(ExperimentalContracts::class) -inline fun buildComposedSuperTypeRef(init: FirComposedSuperTypeRefBuilder.() -> Unit = {}): FirComposedSuperTypeRef { - contract { - callsInPlace(init, kotlin.contracts.InvocationKind.EXACTLY_ONCE) - } - return FirComposedSuperTypeRefBuilder().apply(init).build() -} - -@OptIn(ExperimentalContracts::class) -inline fun buildComposedSuperTypeRefCopy(original: FirComposedSuperTypeRef, init: FirComposedSuperTypeRefBuilder.() -> Unit = {}): FirComposedSuperTypeRef { - contract { - callsInPlace(init, kotlin.contracts.InvocationKind.EXACTLY_ONCE) - } - val copyBuilder = FirComposedSuperTypeRefBuilder() - copyBuilder.source = original.source - copyBuilder.annotations.addAll(original.annotations) - copyBuilder.superTypeRefs.addAll(original.superTypeRefs) - return copyBuilder.apply(init).build() -} diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/impl/FirComposedSuperTypeRefImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/impl/FirComposedSuperTypeRefImpl.kt deleted file mode 100644 index f217189009e..00000000000 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/types/impl/FirComposedSuperTypeRefImpl.kt +++ /dev/null @@ -1,39 +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.types.impl - -import org.jetbrains.kotlin.fir.FirSourceElement -import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall -import org.jetbrains.kotlin.fir.types.FirComposedSuperTypeRef -import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef -import org.jetbrains.kotlin.fir.visitors.* - -/* - * This file was generated automatically - * DO NOT MODIFY IT MANUALLY - */ - -internal class FirComposedSuperTypeRefImpl( - override val source: FirSourceElement?, - override val annotations: MutableList, - override val superTypeRefs: MutableList, -) : FirComposedSuperTypeRef() { - override fun acceptChildren(visitor: FirVisitor, data: D) { - annotations.forEach { it.accept(visitor, data) } - superTypeRefs.forEach { it.accept(visitor, data) } - } - - override fun transformChildren(transformer: FirTransformer, data: D): FirComposedSuperTypeRefImpl { - transformAnnotations(transformer, data) - superTypeRefs.transformInplace(transformer, data) - return this - } - - override fun transformAnnotations(transformer: FirTransformer, data: D): FirComposedSuperTypeRefImpl { - annotations.transformInplace(transformer, data) - return this - } -} diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirTransformer.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirTransformer.kt index 011b3ace157..cbcf887d6a6 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirTransformer.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirTransformer.kt @@ -125,7 +125,6 @@ import org.jetbrains.kotlin.fir.types.FirUserTypeRef import org.jetbrains.kotlin.fir.types.FirDynamicTypeRef import org.jetbrains.kotlin.fir.types.FirFunctionTypeRef import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef -import org.jetbrains.kotlin.fir.types.FirComposedSuperTypeRef import org.jetbrains.kotlin.fir.contracts.FirEffectDeclaration import org.jetbrains.kotlin.fir.contracts.FirContractDescription import org.jetbrains.kotlin.fir.contracts.FirLegacyRawContractDescription @@ -618,10 +617,6 @@ abstract class FirTransformer : FirVisitor { - return transformElement(composedSuperTypeRef, data) - } - open fun transformEffectDeclaration(effectDeclaration: FirEffectDeclaration, data: D): CompositeTransformResult { return transformElement(effectDeclaration, data) } @@ -1122,10 +1117,6 @@ abstract class FirTransformer : FirVisitor { - return transformComposedSuperTypeRef(composedSuperTypeRef, data) - } - final override fun visitEffectDeclaration(effectDeclaration: FirEffectDeclaration, data: D): CompositeTransformResult { return transformEffectDeclaration(effectDeclaration, data) } diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitor.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitor.kt index 9d413a5969d..fd9733dab48 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitor.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitor.kt @@ -125,7 +125,6 @@ import org.jetbrains.kotlin.fir.types.FirUserTypeRef import org.jetbrains.kotlin.fir.types.FirDynamicTypeRef import org.jetbrains.kotlin.fir.types.FirFunctionTypeRef import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef -import org.jetbrains.kotlin.fir.types.FirComposedSuperTypeRef import org.jetbrains.kotlin.fir.contracts.FirEffectDeclaration import org.jetbrains.kotlin.fir.contracts.FirContractDescription import org.jetbrains.kotlin.fir.contracts.FirLegacyRawContractDescription @@ -378,8 +377,6 @@ abstract class FirVisitor { open fun visitImplicitTypeRef(implicitTypeRef: FirImplicitTypeRef, data: D): R = visitElement(implicitTypeRef, data) - open fun visitComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef, data: D): R = visitElement(composedSuperTypeRef, data) - open fun visitEffectDeclaration(effectDeclaration: FirEffectDeclaration, data: D): R = visitElement(effectDeclaration, data) open fun visitContractDescription(contractDescription: FirContractDescription, data: D): R = visitElement(contractDescription, data) diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitorVoid.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitorVoid.kt index 89064e4316c..2cd2bce364c 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitorVoid.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitorVoid.kt @@ -125,7 +125,6 @@ import org.jetbrains.kotlin.fir.types.FirUserTypeRef import org.jetbrains.kotlin.fir.types.FirDynamicTypeRef import org.jetbrains.kotlin.fir.types.FirFunctionTypeRef import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef -import org.jetbrains.kotlin.fir.types.FirComposedSuperTypeRef import org.jetbrains.kotlin.fir.contracts.FirEffectDeclaration import org.jetbrains.kotlin.fir.contracts.FirContractDescription import org.jetbrains.kotlin.fir.contracts.FirLegacyRawContractDescription @@ -616,10 +615,6 @@ abstract class FirVisitorVoid : FirVisitor() { visitElement(implicitTypeRef) } - open fun visitComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef) { - visitElement(composedSuperTypeRef) - } - open fun visitEffectDeclaration(effectDeclaration: FirEffectDeclaration) { visitElement(effectDeclaration) } @@ -1120,10 +1115,6 @@ abstract class FirVisitorVoid : FirVisitor() { visitImplicitTypeRef(implicitTypeRef) } - final override fun visitComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef, data: Nothing?) { - visitComposedSuperTypeRef(composedSuperTypeRef) - } - final override fun visitEffectDeclaration(effectDeclaration: FirEffectDeclaration, data: Nothing?) { visitEffectDeclaration(effectDeclaration) } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/Utils.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/Utils.kt index a4d0c0fb8d3..13d2c3e7ba3 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/Utils.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/Utils.kt @@ -8,7 +8,10 @@ package org.jetbrains.kotlin.fir import org.jetbrains.kotlin.analyzer.ModuleInfo import org.jetbrains.kotlin.fir.expressions.FirBlock import org.jetbrains.kotlin.fir.expressions.FirExpression -import org.jetbrains.kotlin.fir.types.* +import org.jetbrains.kotlin.fir.types.FirDynamicTypeRef +import org.jetbrains.kotlin.fir.types.FirErrorTypeRef +import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef +import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.fir.types.builder.* import org.jetbrains.kotlin.fir.types.impl.* @@ -40,9 +43,6 @@ fun R.copyWithNewSourceKind(newKind: FirFakeSourceElementKind): is FirImplicitTypeRef -> buildImplicitTypeRefCopy(typeRef) { source = newSource } - is FirComposedSuperTypeRef -> buildComposedSuperTypeRefCopy(typeRef) { - source = newSource - } is FirFunctionTypeRefImpl -> buildFunctionTypeRefCopy(typeRef) { source = newSource } diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/BuilderConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/BuilderConfigurator.kt index e2e02b919b0..20501be0b0a 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/BuilderConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/BuilderConfigurator.kt @@ -241,10 +241,6 @@ object BuilderConfigurator : AbstractBuilderConfigurator(FirTree withCopy() } - builder(composedSuperTypeRef) { - withCopy() - } - builder(breakExpression) { parents += loopJumpBuilder } diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/FirTreeBuilder.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/FirTreeBuilder.kt index c54d63eb90d..735a2390931 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/FirTreeBuilder.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/FirTreeBuilder.kt @@ -148,7 +148,6 @@ object FirTreeBuilder : AbstractFirTreeBuilder() { val dynamicTypeRef = element("DynamicTypeRef", TypeRef, typeRefWithNullability) val functionTypeRef = element("FunctionTypeRef", TypeRef, typeRefWithNullability) val implicitTypeRef = element("ImplicitTypeRef", TypeRef, typeRef) - val composedSuperTypeRef = element("ComposedSuperTypeRef", TypeRef, typeRef) val effectDeclaration = element("EffectDeclaration", Contracts) diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt index 4c1ef33be38..634ec2f9339 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt @@ -411,8 +411,6 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator() defaultEmptyList("annotations") } - impl(composedSuperTypeRef) - impl(reference, "FirStubReference") { default("source") { value = "null" diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt index 8cfbf259578..c3af76d7f56 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt @@ -579,10 +579,6 @@ object NodeConfigurator : AbstractFieldConfigurator(FirTreeBuild +booleanField("isSuspend") } - composedSuperTypeRef.configure { - +fieldList("superTypeRefs", resolvedTypeRef) - } - thisReceiverExpression.configure { +field("calleeReference", thisReference) } diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt index 7f8b2710fb9..790eb388187 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirResolveBench.kt @@ -18,9 +18,9 @@ import org.jetbrains.kotlin.fir.lightTree.LightTree2Fir import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.resolve.firProvider import org.jetbrains.kotlin.fir.resolve.providers.impl.FirProviderImpl +import org.jetbrains.kotlin.fir.resolve.transformers.FirGlobalResolveProcessor import org.jetbrains.kotlin.fir.resolve.transformers.FirResolveProcessor import org.jetbrains.kotlin.fir.resolve.transformers.FirTransformerBasedResolveProcessor -import org.jetbrains.kotlin.fir.resolve.transformers.FirGlobalResolveProcessor import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.visitors.FirDefaultVisitorVoid import org.jetbrains.kotlin.psi.KtFile @@ -307,8 +307,6 @@ class FirResolveBench(val withProgress: Boolean) { visitTypeRef(implicitTypeRef) } - override fun visitComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef) {} - override fun visitResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef) { resolvedTypes++ val type = resolvedTypeRef.type @@ -471,4 +469,4 @@ fun RTableContext.RTableRowContext.linePerSecondCell(lines: Int, time: Long, tim } -class FirRuntimeException(override val message: String, override val cause: Throwable) : RuntimeException(message, cause) \ No newline at end of file +class FirRuntimeException(override val message: String, override val cause: Throwable) : RuntimeException(message, cause)