FIR tree. Make intersection type part-types non-null
This commit is contained in:
@@ -1753,8 +1753,8 @@ open class RawFirBuilder(
|
|||||||
is KtIntersectionType -> FirIntersectionTypeRefBuilder().apply {
|
is KtIntersectionType -> FirIntersectionTypeRefBuilder().apply {
|
||||||
this.source = source
|
this.source = source
|
||||||
isMarkedNullable = isNullable
|
isMarkedNullable = isNullable
|
||||||
leftType = unwrappedElement.getLeftTypeRef()?.toFirOrErrorType()
|
leftType = unwrappedElement.getLeftTypeRef().toFirOrErrorType()
|
||||||
rightType = unwrappedElement.getRightTypeRef()?.toFirOrErrorType()
|
rightType = unwrappedElement.getRightTypeRef().toFirOrErrorType()
|
||||||
}
|
}
|
||||||
null -> FirErrorTypeRefBuilder().apply {
|
null -> FirErrorTypeRefBuilder().apply {
|
||||||
this.source = source
|
this.source = source
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ abstract class FirIntersectionTypeRef : FirTypeRefWithNullability() {
|
|||||||
abstract override val source: KtSourceElement?
|
abstract override val source: KtSourceElement?
|
||||||
abstract override val annotations: List<FirAnnotation>
|
abstract override val annotations: List<FirAnnotation>
|
||||||
abstract override val isMarkedNullable: Boolean
|
abstract override val isMarkedNullable: Boolean
|
||||||
abstract val leftType: FirTypeRef?
|
abstract val leftType: FirTypeRef
|
||||||
abstract val rightType: FirTypeRef?
|
abstract val rightType: FirTypeRef
|
||||||
|
|
||||||
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitIntersectionTypeRef(this, data)
|
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitIntersectionTypeRef(this, data)
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -25,8 +25,8 @@ class FirIntersectionTypeRefBuilder : FirAnnotationContainerBuilder {
|
|||||||
override var source: KtSourceElement? = null
|
override var source: KtSourceElement? = null
|
||||||
override val annotations: MutableList<FirAnnotation> = mutableListOf()
|
override val annotations: MutableList<FirAnnotation> = mutableListOf()
|
||||||
var isMarkedNullable: Boolean by kotlin.properties.Delegates.notNull<Boolean>()
|
var isMarkedNullable: Boolean by kotlin.properties.Delegates.notNull<Boolean>()
|
||||||
var leftType: FirTypeRef? = null
|
lateinit var leftType: FirTypeRef
|
||||||
var rightType: FirTypeRef? = null
|
lateinit var rightType: FirTypeRef
|
||||||
|
|
||||||
override fun build(): FirIntersectionTypeRef {
|
override fun build(): FirIntersectionTypeRef {
|
||||||
return FirIntersectionTypeRefImpl(
|
return FirIntersectionTypeRefImpl(
|
||||||
|
|||||||
+6
-6
@@ -20,19 +20,19 @@ internal class FirIntersectionTypeRefImpl(
|
|||||||
override val source: KtSourceElement?,
|
override val source: KtSourceElement?,
|
||||||
override val annotations: MutableList<FirAnnotation>,
|
override val annotations: MutableList<FirAnnotation>,
|
||||||
override val isMarkedNullable: Boolean,
|
override val isMarkedNullable: Boolean,
|
||||||
override var leftType: FirTypeRef?,
|
override var leftType: FirTypeRef,
|
||||||
override var rightType: FirTypeRef?,
|
override var rightType: FirTypeRef,
|
||||||
) : FirIntersectionTypeRef() {
|
) : FirIntersectionTypeRef() {
|
||||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||||
annotations.forEach { it.accept(visitor, data) }
|
annotations.forEach { it.accept(visitor, data) }
|
||||||
leftType?.accept(visitor, data)
|
leftType.accept(visitor, data)
|
||||||
rightType?.accept(visitor, data)
|
rightType.accept(visitor, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirIntersectionTypeRefImpl {
|
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirIntersectionTypeRefImpl {
|
||||||
transformAnnotations(transformer, data)
|
transformAnnotations(transformer, data)
|
||||||
leftType = leftType?.transform(transformer, data)
|
leftType = leftType.transform(transformer, data)
|
||||||
rightType = rightType?.transform(transformer, data)
|
rightType = rightType.transform(transformer, data)
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -644,8 +644,8 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
|||||||
}
|
}
|
||||||
|
|
||||||
intersectionTypeRef.configure {
|
intersectionTypeRef.configure {
|
||||||
+field("leftType", typeRef, nullable = true)
|
+field("leftType", typeRef)
|
||||||
+field("rightType", typeRef, nullable = true)
|
+field("rightType", typeRef)
|
||||||
}
|
}
|
||||||
|
|
||||||
thisReceiverExpression.configure {
|
thisReceiverExpression.configure {
|
||||||
|
|||||||
Reference in New Issue
Block a user