diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/type/FirDuplicateParameterNameInFunctionTypeChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/type/FirDuplicateParameterNameInFunctionTypeChecker.kt index 8fc389b22e0..bbd1d3e4887 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/type/FirDuplicateParameterNameInFunctionTypeChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/type/FirDuplicateParameterNameInFunctionTypeChecker.kt @@ -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 diff --git a/compiler/testData/diagnostics/tests/duplicateParameterName.fir.kt b/compiler/testData/diagnostics/tests/duplicateParameterName.fir.kt deleted file mode 100644 index bd86bb1d8c9..00000000000 --- a/compiler/testData/diagnostics/tests/duplicateParameterName.fir.kt +++ /dev/null @@ -1,41 +0,0 @@ -// ISSUE: KT-65584 -// WITH_STDLIB - -fun interface Flow { - - suspend fun collect(collector: FlowCollector) -} - -fun interface FlowCollector { - - suspend fun emit(value: T) -} - -inline fun Flow.flatMapLatest(crossinline transform: suspend (value: T) -> Flow) = Flow { collector -> - collect { it1 -> transform(it1).collect { it2 -> collector.emit(it2) } } -} - -fun flowOf(value: T): Flow = Flow { collector -> collector.emit(value) } - -inline fun Flow.map(crossinline transform: suspend (value: T) -> R): Flow = Flow { collector -> - collect { collector.emit(transform(it)) } -} - -// ------ - -class StationId -class Playable -class Entity(val stationId: StationId) -class State(val playbackEntity: Entity) - -internal suspend fun init( - queueState: State, - state: Flow -) { - state - .flatMapLatest { playable -> - flowOf(playable).map { Triple(it, playable, queueState.playbackEntity.stationId) } - } - .collect { (likeState, playable, stationId) -> - } -} diff --git a/compiler/testData/diagnostics/tests/duplicateParameterName.kt b/compiler/testData/diagnostics/tests/duplicateParameterName.kt index 01f26095144..9881716ae91 100644 --- a/compiler/testData/diagnostics/tests/duplicateParameterName.kt +++ b/compiler/testData/diagnostics/tests/duplicateParameterName.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // ISSUE: KT-65584 // WITH_STDLIB diff --git a/compiler/testData/diagnostics/tests/duplicateParameterNameSimplified.fir.kt b/compiler/testData/diagnostics/tests/duplicateParameterNameSimplified.fir.kt index c3e3891a599..615289fbba6 100644 --- a/compiler/testData/diagnostics/tests/duplicateParameterNameSimplified.fir.kt +++ b/compiler/testData/diagnostics/tests/duplicateParameterNameSimplified.fir.kt @@ -8,7 +8,7 @@ class MyTriple(val a: T, val b: K, val c: M) fun test() { giveItName(10) { - MyTriple(it, it, it).also { self -> } + MyTriple(it, it, it).also { self -> } (duplicateIt(it) { a, b -> }).also { function -> } } }