[FIR] Remove redundant INITIALIZER_TYPE_MISMATCH introduced earlier

This commit is contained in:
Nikolay Lunyak
2024-02-09 11:19:51 +02:00
committed by Space Team
parent 389f02b016
commit fdb2b714c9
4 changed files with 6 additions and 4 deletions
@@ -13,11 +13,12 @@ import org.jetbrains.kotlin.fir.analysis.checkers.checkTypeMismatch
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.declarations.FirProperty
import org.jetbrains.kotlin.fir.expressions.FirComponentCall
import org.jetbrains.kotlin.fir.expressions.FirErrorExpression
import org.jetbrains.kotlin.fir.types.coneType
object FirInitializerTypeMismatchChecker : FirPropertyChecker(MppCheckerKind.Common) {
override fun check(declaration: FirProperty, context: CheckerContext, reporter: DiagnosticReporter) {
val initializer = declaration.initializer ?: return
val initializer = declaration.initializer?.takeIf { it !is FirErrorExpression } ?: return
val source = declaration.source ?: return
if (source.elementType == KtNodeTypes.DESTRUCTURING_DECLARATION) return
if (initializer is FirComponentCall) return
@@ -10,11 +10,12 @@ import org.jetbrains.kotlin.fir.analysis.checkers.MppCheckerKind
import org.jetbrains.kotlin.fir.analysis.checkers.checkTypeMismatch
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
import org.jetbrains.kotlin.fir.expressions.FirErrorExpression
import org.jetbrains.kotlin.fir.types.coneType
object FirValueParameterDefaultValueTypeMismatchChecker : FirValueParameterChecker(MppCheckerKind.Common) {
override fun check(declaration: FirValueParameter, context: CheckerContext, reporter: DiagnosticReporter) {
val defaultValue = declaration.defaultValue ?: return
val defaultValue = declaration.defaultValue?.takeIf { it !is FirErrorExpression } ?: return
val source = requireNotNull(declaration.source)
val parameterType = declaration.returnTypeRef.coneType