[FIR] Use common isPlaceholder check for type arguments in RawFirBuilder

This commit is contained in:
Victor Petukhov
2021-10-22 14:36:25 +03:00
parent 5508d40371
commit c9fbbe74ae
@@ -1775,10 +1775,6 @@ open class RawFirBuilder(
} }
} }
// TODO introduce placeholder projection type
private fun KtTypeProjection.isPlaceholderProjection() =
projectionKind == KtProjectionKind.NONE && (typeReference?.typeElement as? KtUserType)?.referencedName == "_"
override fun visitTypeProjection(typeProjection: KtTypeProjection, data: Unit): FirElement { override fun visitTypeProjection(typeProjection: KtTypeProjection, data: Unit): FirElement {
val projectionKind = typeProjection.projectionKind val projectionKind = typeProjection.projectionKind
val projectionSource = typeProjection.toFirSourceElement() val projectionSource = typeProjection.toFirSourceElement()
@@ -1787,10 +1783,10 @@ open class RawFirBuilder(
source = projectionSource source = projectionSource
} }
} }
if (typeProjection.isPlaceholderProjection()) { val typeReference = typeProjection.typeReference
if (typeReference?.isPlaceholder == true) {
return FirTypePlaceholderProjection return FirTypePlaceholderProjection
} }
val typeReference = typeProjection.typeReference
val firType = typeReference.toFirOrErrorType() val firType = typeReference.toFirOrErrorType()
return buildTypeProjectionWithVariance { return buildTypeProjectionWithVariance {
source = projectionSource source = projectionSource