[FIR] Get rid of implicit type refs with source
#KT-55835
This commit is contained in:
committed by
Space Team
parent
91dad7b952
commit
070b694247
-52
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2023 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.
|
||||
*/
|
||||
|
||||
@file:Suppress("DuplicatedCode", "unused")
|
||||
|
||||
package org.jetbrains.kotlin.fir.types.builder
|
||||
|
||||
import kotlin.contracts.*
|
||||
import org.jetbrains.kotlin.KtSourceElement
|
||||
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl
|
||||
import org.jetbrains.kotlin.fir.builder.toMutableOrEmpty
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
|
||||
import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirImplicitTypeRefImpl
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
*/
|
||||
|
||||
@FirBuilderDsl
|
||||
class FirImplicitTypeRefBuilder {
|
||||
lateinit var source: KtSourceElement
|
||||
|
||||
fun build(): FirImplicitTypeRef {
|
||||
return FirImplicitTypeRefImpl(
|
||||
source,
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
inline fun buildImplicitTypeRef(init: FirImplicitTypeRefBuilder.() -> Unit): FirImplicitTypeRef {
|
||||
contract {
|
||||
callsInPlace(init, kotlin.contracts.InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
return FirImplicitTypeRefBuilder().apply(init).build()
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
inline fun buildImplicitTypeRefCopy(original: FirImplicitTypeRef, init: FirImplicitTypeRefBuilder.() -> Unit): FirImplicitTypeRef {
|
||||
contract {
|
||||
callsInPlace(init, kotlin.contracts.InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
val copyBuilder = FirImplicitTypeRefBuilder()
|
||||
original.source?.let { copyBuilder.source = it }
|
||||
return copyBuilder.apply(init).build()
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2023 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.
|
||||
*/
|
||||
|
||||
@file:Suppress("DuplicatedCode", "unused")
|
||||
|
||||
package org.jetbrains.kotlin.fir.types.impl
|
||||
|
||||
import org.jetbrains.kotlin.KtSourceElement
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
|
||||
import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
import org.jetbrains.kotlin.fir.MutableOrEmptyList
|
||||
import org.jetbrains.kotlin.fir.builder.toMutableOrEmpty
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
*/
|
||||
|
||||
internal class FirImplicitTypeRefImpl(
|
||||
override val source: KtSourceElement,
|
||||
) : FirImplicitTypeRef() {
|
||||
override val annotations: List<FirAnnotation> get() = emptyList()
|
||||
|
||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||
}
|
||||
|
||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirImplicitTypeRefImpl {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirImplicitTypeRefImpl {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {}
|
||||
}
|
||||
@@ -53,9 +53,6 @@ fun <R : FirTypeRef> R.copyWithNewSource(newSource: KtSourceElement?): R {
|
||||
qualifier += typeRef.qualifier
|
||||
annotations += typeRef.annotations
|
||||
}
|
||||
is FirImplicitTypeRef -> newSource?.let {
|
||||
buildImplicitTypeRefCopy(typeRef) { source = it }
|
||||
} ?: FirImplicitTypeRefImplWithoutSource
|
||||
is FirFunctionTypeRefImpl -> buildFunctionTypeRefCopy(typeRef) {
|
||||
source = newSource
|
||||
}
|
||||
|
||||
+1
-7
@@ -313,10 +313,6 @@ object BuilderConfigurator : AbstractBuilderConfigurator<FirTreeBuilder>(FirTree
|
||||
withCopy()
|
||||
}
|
||||
|
||||
builder(implicitTypeRef) {
|
||||
withCopy()
|
||||
}
|
||||
|
||||
builder(breakExpression) {
|
||||
parents += loopJumpBuilder
|
||||
}
|
||||
@@ -442,9 +438,7 @@ object BuilderConfigurator : AbstractBuilderConfigurator<FirTreeBuilder>(FirTree
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
findImplementationsWithElementInParents(annotationContainer) {
|
||||
it.type !in setOf("FirImplicitTypeRefImpl")
|
||||
}.forEach {
|
||||
findImplementationsWithElementInParents(annotationContainer).forEach {
|
||||
it.builder?.parents?.add(annotationContainerBuilder)
|
||||
}
|
||||
|
||||
|
||||
+1
-6
@@ -536,12 +536,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
}
|
||||
|
||||
impl(functionTypeRef)
|
||||
impl(implicitTypeRef) {
|
||||
defaultEmptyList("annotations")
|
||||
default("source") {
|
||||
notNull = true
|
||||
}
|
||||
}
|
||||
noImpl(implicitTypeRef)
|
||||
|
||||
impl(reference, "FirStubReference") {
|
||||
default("source") {
|
||||
|
||||
Reference in New Issue
Block a user