FIR checker: more specific type for CONFLICTIONG_PROJECTION
This commit is contained in:
committed by
teamcityserver
parent
8d474c0e7e
commit
a3105da32e
+1
-1
@@ -327,7 +327,7 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
|
|||||||
val ILLEGAL_PROJECTION_USAGE by error<PsiElement>()
|
val ILLEGAL_PROJECTION_USAGE by error<PsiElement>()
|
||||||
val TYPE_PARAMETERS_IN_ENUM by error<PsiElement>()
|
val TYPE_PARAMETERS_IN_ENUM by error<PsiElement>()
|
||||||
val CONFLICTING_PROJECTION by error<PsiElement> {
|
val CONFLICTING_PROJECTION by error<PsiElement> {
|
||||||
parameter<String>("type") // TODO use ConeType instead of String
|
parameter<ConeKotlinType>("type")
|
||||||
}
|
}
|
||||||
val VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED by error<KtTypeParameter>(PositioningStrategy.VARIANCE_MODIFIER)
|
val VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED by error<KtTypeParameter>(PositioningStrategy.VARIANCE_MODIFIER)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -249,7 +249,7 @@ object FirErrors {
|
|||||||
val TYPE_PARAMETERS_IN_OBJECT by error0<PsiElement>()
|
val TYPE_PARAMETERS_IN_OBJECT by error0<PsiElement>()
|
||||||
val ILLEGAL_PROJECTION_USAGE by error0<PsiElement>()
|
val ILLEGAL_PROJECTION_USAGE by error0<PsiElement>()
|
||||||
val TYPE_PARAMETERS_IN_ENUM by error0<PsiElement>()
|
val TYPE_PARAMETERS_IN_ENUM by error0<PsiElement>()
|
||||||
val CONFLICTING_PROJECTION by error1<PsiElement, String>()
|
val CONFLICTING_PROJECTION by error1<PsiElement, ConeKotlinType>()
|
||||||
val VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED by error0<KtTypeParameter>(SourceElementPositioningStrategies.VARIANCE_MODIFIER)
|
val VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED by error0<KtTypeParameter>(SourceElementPositioningStrategies.VARIANCE_MODIFIER)
|
||||||
val CATCH_PARAMETER_WITH_DEFAULT_VALUE by error0<PsiElement>()
|
val CATCH_PARAMETER_WITH_DEFAULT_VALUE by error0<PsiElement>()
|
||||||
val REIFIED_TYPE_IN_CATCH_CLAUSE by error0<PsiElement>()
|
val REIFIED_TYPE_IN_CATCH_CLAUSE by error0<PsiElement>()
|
||||||
|
|||||||
+1
-1
@@ -66,7 +66,7 @@ object FirConflictingProjectionChecker : FirBasicDeclarationChecker() {
|
|||||||
actual is ConeKotlinTypeProjectionIn && protoVariance == Variance.OUT_VARIANCE ||
|
actual is ConeKotlinTypeProjectionIn && protoVariance == Variance.OUT_VARIANCE ||
|
||||||
actual is ConeKotlinTypeProjectionOut && protoVariance == Variance.IN_VARIANCE
|
actual is ConeKotlinTypeProjectionOut && protoVariance == Variance.IN_VARIANCE
|
||||||
) {
|
) {
|
||||||
reporter.reportOn(typeRef.source, FirErrors.CONFLICTING_PROJECTION, typeRef.coneType.toString(), context)
|
reporter.reportOn(typeRef.source, FirErrors.CONFLICTING_PROJECTION, typeRef.coneType, context)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -559,7 +559,7 @@ class FirDefaultErrorMessages : DefaultErrorMessages.Extension {
|
|||||||
map.put(
|
map.put(
|
||||||
CONFLICTING_PROJECTION,
|
CONFLICTING_PROJECTION,
|
||||||
"Projection is conflicting with variance of the corresponding type parameter of {0}. Remove the projection or replace it with ''*''",
|
"Projection is conflicting with variance of the corresponding type parameter of {0}. Remove the projection or replace it with ''*''",
|
||||||
TO_STRING
|
RENDER_TYPE
|
||||||
)
|
)
|
||||||
map.put(
|
map.put(
|
||||||
VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED,
|
VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED,
|
||||||
|
|||||||
+1
-1
@@ -1050,7 +1050,7 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
|||||||
}
|
}
|
||||||
add(FirErrors.CONFLICTING_PROJECTION) { firDiagnostic ->
|
add(FirErrors.CONFLICTING_PROJECTION) { firDiagnostic ->
|
||||||
ConflictingProjectionImpl(
|
ConflictingProjectionImpl(
|
||||||
firDiagnostic.a,
|
firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a),
|
||||||
firDiagnostic as FirPsiDiagnostic<*>,
|
firDiagnostic as FirPsiDiagnostic<*>,
|
||||||
token,
|
token,
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -743,7 +743,7 @@ sealed class KtFirDiagnostic<PSI: PsiElement> : KtDiagnosticWithPsi<PSI> {
|
|||||||
|
|
||||||
abstract class ConflictingProjection : KtFirDiagnostic<PsiElement>() {
|
abstract class ConflictingProjection : KtFirDiagnostic<PsiElement>() {
|
||||||
override val diagnosticClass get() = ConflictingProjection::class
|
override val diagnosticClass get() = ConflictingProjection::class
|
||||||
abstract val type: String
|
abstract val type: KtType
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class VarianceOnTypeParameterNotAllowed : KtFirDiagnostic<KtTypeParameter>() {
|
abstract class VarianceOnTypeParameterNotAllowed : KtFirDiagnostic<KtTypeParameter>() {
|
||||||
|
|||||||
+1
-1
@@ -1196,7 +1196,7 @@ internal class TypeParametersInEnumImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal class ConflictingProjectionImpl(
|
internal class ConflictingProjectionImpl(
|
||||||
override val type: String,
|
override val type: KtType,
|
||||||
firDiagnostic: FirPsiDiagnostic<*>,
|
firDiagnostic: FirPsiDiagnostic<*>,
|
||||||
override val token: ValidityToken,
|
override val token: ValidityToken,
|
||||||
) : KtFirDiagnostic.ConflictingProjection(), KtAbstractFirDiagnostic<PsiElement> {
|
) : KtFirDiagnostic.ConflictingProjection(), KtAbstractFirDiagnostic<PsiElement> {
|
||||||
|
|||||||
Reference in New Issue
Block a user