[FIR] introduce FirErrorTypeRef.partiallyResolvedTypeRef
^KT-58125
This commit is contained in:
committed by
Space Team
parent
da35f436b3
commit
2cd4ff11f0
+5
@@ -181,6 +181,11 @@ class FirSpecificTypeResolverTransformer(
|
||||
return resolvedTypeRef
|
||||
}
|
||||
|
||||
override fun transformErrorTypeRef(errorTypeRef: FirErrorTypeRef, data: ScopeClassDeclaration): FirTypeRef {
|
||||
errorTypeRef.transformPartiallyResolvedTypeRef(this, data)
|
||||
return errorTypeRef
|
||||
}
|
||||
|
||||
override fun transformImplicitTypeRef(implicitTypeRef: FirImplicitTypeRef, data: ScopeClassDeclaration): FirTypeRef {
|
||||
return implicitTypeRef
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ abstract class FirErrorTypeRef : FirResolvedTypeRef(), FirDiagnosticHolder {
|
||||
abstract override val delegatedTypeRef: FirTypeRef?
|
||||
abstract override val isFromStubType: Boolean
|
||||
abstract override val diagnostic: ConeDiagnostic
|
||||
abstract val partiallyResolvedTypeRef: FirTypeRef?
|
||||
|
||||
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitErrorTypeRef(this, data)
|
||||
|
||||
@@ -34,4 +35,6 @@ abstract class FirErrorTypeRef : FirResolvedTypeRef(), FirDiagnosticHolder {
|
||||
abstract override fun replaceAnnotations(newAnnotations: List<FirAnnotation>)
|
||||
|
||||
abstract override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirErrorTypeRef
|
||||
|
||||
abstract fun <D> transformPartiallyResolvedTypeRef(transformer: FirTransformer<D>, data: D): FirErrorTypeRef
|
||||
}
|
||||
|
||||
+7
-4
@@ -5,18 +5,17 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.types.builder
|
||||
|
||||
import kotlin.contracts.*
|
||||
import org.jetbrains.kotlin.KtSourceElement
|
||||
import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder
|
||||
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
|
||||
import org.jetbrains.kotlin.fir.types.ConeErrorType
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.fir.types.FirErrorTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirErrorTypeRefImpl
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.contract
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
@@ -28,6 +27,8 @@ class FirErrorTypeRefBuilder : FirAnnotationContainerBuilder {
|
||||
override var source: KtSourceElement? = null
|
||||
var type: ConeKotlinType? = null
|
||||
var delegatedTypeRef: FirTypeRef? = null
|
||||
var partiallyResolvedTypeRef: FirTypeRef? = null
|
||||
|
||||
lateinit var diagnostic: ConeDiagnostic
|
||||
|
||||
override fun build(): FirErrorTypeRef {
|
||||
@@ -37,13 +38,15 @@ class FirErrorTypeRefBuilder : FirAnnotationContainerBuilder {
|
||||
source,
|
||||
type,
|
||||
delegatedTypeRef,
|
||||
diagnostic
|
||||
diagnostic,
|
||||
partiallyResolvedTypeRef = partiallyResolvedTypeRef,
|
||||
)
|
||||
} else {
|
||||
FirErrorTypeRefImpl(
|
||||
source,
|
||||
delegatedTypeRef,
|
||||
diagnostic,
|
||||
partiallyResolvedTypeRef = partiallyResolvedTypeRef,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,29 +13,35 @@ import org.jetbrains.kotlin.fir.types.ConeErrorType
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.fir.types.FirErrorTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
import org.jetbrains.kotlin.fir.visitors.FirTransformer
|
||||
import org.jetbrains.kotlin.fir.visitors.FirVisitor
|
||||
import org.jetbrains.kotlin.fir.visitors.transformInplace
|
||||
|
||||
internal class FirErrorTypeRefImpl(
|
||||
override val source: KtSourceElement?,
|
||||
override val type: ConeKotlinType,
|
||||
override var delegatedTypeRef: FirTypeRef?,
|
||||
override val diagnostic: ConeDiagnostic,
|
||||
override val isFromStubType: Boolean = false
|
||||
override val isFromStubType: Boolean = false,
|
||||
override var partiallyResolvedTypeRef: FirTypeRef? = null,
|
||||
) : FirErrorTypeRef() {
|
||||
constructor(source: KtSourceElement?, delegatedTypeRef: FirTypeRef?, diagnostic: ConeDiagnostic,
|
||||
isFromStubType: Boolean = false
|
||||
constructor(
|
||||
source: KtSourceElement?, delegatedTypeRef: FirTypeRef?, diagnostic: ConeDiagnostic,
|
||||
isFromStubType: Boolean = false, partiallyResolvedTypeRef: FirTypeRef? = null,
|
||||
) : this(
|
||||
source,
|
||||
ConeErrorType(diagnostic),
|
||||
delegatedTypeRef,
|
||||
diagnostic,
|
||||
isFromStubType
|
||||
isFromStubType,
|
||||
partiallyResolvedTypeRef,
|
||||
)
|
||||
|
||||
override val annotations: MutableOrEmptyList<FirAnnotation> = MutableOrEmptyList.empty()
|
||||
|
||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||
annotations.forEach { it.accept(visitor, data) }
|
||||
partiallyResolvedTypeRef?.accept(visitor, data)
|
||||
}
|
||||
|
||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirErrorTypeRefImpl {
|
||||
@@ -51,4 +57,9 @@ internal class FirErrorTypeRefImpl(
|
||||
annotations.transformInplace(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformPartiallyResolvedTypeRef(transformer: FirTransformer<D>, data: D): FirErrorTypeRef {
|
||||
partiallyResolvedTypeRef = partiallyResolvedTypeRef?.transform(transformer, data)
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -717,6 +717,10 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
+fieldList("contextReceiverTypeRefs", typeRef)
|
||||
}
|
||||
|
||||
errorTypeRef.configure {
|
||||
+field("partiallyResolvedTypeRef", typeRef, nullable = true).withTransform()
|
||||
}
|
||||
|
||||
intersectionTypeRef.configure {
|
||||
+field("leftType", typeRef)
|
||||
+field("rightType", typeRef)
|
||||
|
||||
Reference in New Issue
Block a user