FIR: Drop unused FirComposedSuperTypeRef

This commit is contained in:
Denis Zharkov
2020-11-15 13:28:12 +03:00
parent ad35723f56
commit 387fd895a6
13 changed files with 10 additions and 172 deletions
@@ -171,17 +171,10 @@ class CallAndReferenceGenerator(
return null
}
val superTypeRef = dispatchReceiverReference.superTypeRef
val coneSuperType = superTypeRef.coneTypeSafe<ConeClassLikeType>()
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<ConeClassLikeType>() ?: return null
val firClassSymbol = coneSuperType.fullyExpandedType(session).lookupTag.toSymbol(session) as? FirClassSymbol<*>
if (firClassSymbol != null) {
return classifierStorage.getIrClassSymbol(firClassSymbol)
}
return 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<FirAnnotationCall>
abstract val superTypeRefs: List<FirResolvedTypeRef>
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitComposedSuperTypeRef(this, data)
abstract override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirComposedSuperTypeRef
}
@@ -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<FirAnnotationCall> = mutableListOf()
val superTypeRefs: MutableList<FirResolvedTypeRef> = 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()
}
@@ -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<FirAnnotationCall>,
override val superTypeRefs: MutableList<FirResolvedTypeRef>,
) : FirComposedSuperTypeRef() {
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
annotations.forEach { it.accept(visitor, data) }
superTypeRefs.forEach { it.accept(visitor, data) }
}
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirComposedSuperTypeRefImpl {
transformAnnotations(transformer, data)
superTypeRefs.transformInplace(transformer, data)
return this
}
override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirComposedSuperTypeRefImpl {
annotations.transformInplace(transformer, data)
return this
}
}
@@ -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<in D> : FirVisitor<CompositeTransformResult<FirEle
return transformElement(implicitTypeRef, data)
}
open fun transformComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef, data: D): CompositeTransformResult<FirTypeRef> {
return transformElement(composedSuperTypeRef, data)
}
open fun transformEffectDeclaration(effectDeclaration: FirEffectDeclaration, data: D): CompositeTransformResult<FirEffectDeclaration> {
return transformElement(effectDeclaration, data)
}
@@ -1122,10 +1117,6 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
return transformImplicitTypeRef(implicitTypeRef, data)
}
final override fun visitComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef, data: D): CompositeTransformResult<FirTypeRef> {
return transformComposedSuperTypeRef(composedSuperTypeRef, data)
}
final override fun visitEffectDeclaration(effectDeclaration: FirEffectDeclaration, data: D): CompositeTransformResult<FirEffectDeclaration> {
return transformEffectDeclaration(effectDeclaration, data)
}
@@ -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<out R, in D> {
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)
@@ -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<Unit, Nothing?>() {
visitElement(implicitTypeRef)
}
open fun visitComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef) {
visitElement(composedSuperTypeRef)
}
open fun visitEffectDeclaration(effectDeclaration: FirEffectDeclaration) {
visitElement(effectDeclaration)
}
@@ -1120,10 +1115,6 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
visitImplicitTypeRef(implicitTypeRef)
}
final override fun visitComposedSuperTypeRef(composedSuperTypeRef: FirComposedSuperTypeRef, data: Nothing?) {
visitComposedSuperTypeRef(composedSuperTypeRef)
}
final override fun visitEffectDeclaration(effectDeclaration: FirEffectDeclaration, data: Nothing?) {
visitEffectDeclaration(effectDeclaration)
}
@@ -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 : FirTypeRef> R.copyWithNewSourceKind(newKind: FirFakeSourceElementKind):
is FirImplicitTypeRef -> buildImplicitTypeRefCopy(typeRef) {
source = newSource
}
is FirComposedSuperTypeRef -> buildComposedSuperTypeRefCopy(typeRef) {
source = newSource
}
is FirFunctionTypeRefImpl -> buildFunctionTypeRefCopy(typeRef) {
source = newSource
}
@@ -241,10 +241,6 @@ object BuilderConfigurator : AbstractBuilderConfigurator<FirTreeBuilder>(FirTree
withCopy()
}
builder(composedSuperTypeRef) {
withCopy()
}
builder(breakExpression) {
parents += loopJumpBuilder
}
@@ -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)
@@ -411,8 +411,6 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
defaultEmptyList("annotations")
}
impl(composedSuperTypeRef)
impl(reference, "FirStubReference") {
default("source") {
value = "null"
@@ -579,10 +579,6 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
+booleanField("isSuspend")
}
composedSuperTypeRef.configure {
+fieldList("superTypeRefs", resolvedTypeRef)
}
thisReceiverExpression.configure {
+field("calleeReference", thisReference)
}
@@ -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)
class FirRuntimeException(override val message: String, override val cause: Throwable) : RuntimeException(message, cause)