From fa80f40e7462586d20bc2e0e1c066014281de7fb Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 20 Mar 2018 12:00:52 +0300 Subject: [PATCH] FIR: no nullability in error type --- .../org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt | 10 +++++----- .../tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt | 2 +- .../kotlin/fir/types/impl/FirErrorTypeImpl.kt | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt index 944c62eda01..176d33f94c3 100644 --- a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt +++ b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt @@ -69,7 +69,7 @@ class RawFirBuilder(val session: FirSession) { convertSafe() ?: FirImplicitTypeImpl(session, this) private fun KtTypeReference?.toFirOrErrorType(): FirType = - convertSafe() ?: FirErrorTypeImpl(session, this, false, if (this == null) "Incomplete code" else "Conversion failed") + convertSafe() ?: FirErrorTypeImpl(session, this, if (this == null) "Incomplete code" else "Conversion failed") private fun KtExpression?.toFirBody(): FirBody? = convertSafe()?.let { it as? FirBody ?: FirExpressionBodyImpl(session, it) } @@ -178,7 +178,7 @@ class RawFirBuilder(val session: FirSession) { FirDelegatedConstructorCallImpl( session, constructorCallee, - FirErrorTypeImpl(session, constructorCallee, false, "Not implemented yet"), + FirErrorTypeImpl(session, constructorCallee, "Not implemented yet"), isThis = false ).apply { superTypeCallEntry.extractArgumentsTo(this) @@ -317,7 +317,7 @@ class RawFirBuilder(val session: FirSession) { val firConstructorCall = FirDelegatedConstructorCallImpl( session, call, - FirErrorTypeImpl(session, call, false, "Not implemented yet"), + FirErrorTypeImpl(session, call, "Not implemented yet"), call.isCallToThis || call.isImplicit ) call.extractArgumentsTo(firConstructorCall) @@ -384,7 +384,7 @@ class RawFirBuilder(val session: FirSession) { } while (referenceExpression != null) userType } else { - FirErrorTypeImpl(session, typeReference, isNullable, "Incomplete user type") + FirErrorTypeImpl(session, typeReference, "Incomplete user type") } } is KtFunctionType -> { @@ -400,7 +400,7 @@ class RawFirBuilder(val session: FirSession) { } functionType } - null -> FirErrorTypeImpl(session, typeReference, isNullable, "Unwrapped type is null") + null -> FirErrorTypeImpl(session, typeReference, "Unwrapped type is null") else -> throw AssertionError("Unexpected type element: ${unwrappedElement.text}") } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt index 3febb638877..2061df2874f 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt @@ -333,7 +333,7 @@ class FirRenderer(builder: StringBuilder) : FirVisitorVoid() { override fun visitErrorType(errorType: FirErrorType) { visitType(errorType) - print("") + print("") } override fun visitImplicitType(implicitType: FirImplicitType) { diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirErrorTypeImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirErrorTypeImpl.kt index 4677e4b26e5..24b729c397a 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirErrorTypeImpl.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/impl/FirErrorTypeImpl.kt @@ -13,9 +13,8 @@ import org.jetbrains.kotlin.fir.visitors.FirVisitor class FirErrorTypeImpl( session: FirSession, psi: PsiElement?, - isNullable: Boolean, override val reason: String -) : FirAbstractAnnotatedType(session, psi, isNullable), FirErrorType { +) : FirAbstractAnnotatedType(session, psi, false), FirErrorType { override fun accept(visitor: FirVisitor, data: D): R { return super.accept(visitor, data) }