[FIR] Fix FirDuplicateParameterNameInFunctionTypeChecker

It was supposed to check only function types...

Also note that it's probably impossible
to write a simpler test right now,
because we have a massive problem that
we ignore `FirTypeRef`s with `null`
sources despite having a dedicated
family of checkers for them
specifically. This will be fixed
separately as KT-65647.

^KT-65584 Fixed
^KT-65647
This commit is contained in:
Nikolay Lunyak
2024-02-07 18:04:37 +02:00
committed by Space Team
parent 8ec248131d
commit 3db7df6898
4 changed files with 4 additions and 47 deletions
@@ -13,14 +13,11 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.declarations.getAnnotationByClassId
import org.jetbrains.kotlin.fir.expressions.FirLiteralExpression
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
import org.jetbrains.kotlin.fir.types.FirTypeRef
import org.jetbrains.kotlin.fir.types.customAnnotations
import org.jetbrains.kotlin.fir.types.type
import org.jetbrains.kotlin.fir.types.*
object FirDuplicateParameterNameInFunctionTypeChecker : FirTypeRefChecker(MppCheckerKind.Common) {
override fun check(typeRef: FirTypeRef, context: CheckerContext, reporter: DiagnosticReporter) {
if (typeRef !is FirResolvedTypeRef) return
if (typeRef !is FirResolvedTypeRef || !typeRef.type.isSomeFunctionType(context.session)) return
val nameToArgumentProjection = typeRef.type.typeArguments.dropLast(1).groupBy {
val type = it.type ?: return@groupBy null