diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirExpressionBuilder.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirExpressionBuilder.kt index 608616ffe01..3411886523a 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirExpressionBuilder.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirExpressionBuilder.kt @@ -1205,7 +1205,8 @@ class LightTreeRawFirExpressionBuilder( } explicitReceiver = generateResolvedAccessExpression(rangeSource, iteratorVal) }, - valueParameter.returnTypeRef + valueParameter.returnTypeRef, + extractedAnnotations = valueParameter.annotations ) if (multiDeclaration != null) { statements.addDestructuringStatements( diff --git a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiRawFirBuilder.kt b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiRawFirBuilder.kt index bebf852602e..1aad2802f8c 100644 --- a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiRawFirBuilder.kt +++ b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/PsiRawFirBuilder.kt @@ -2645,6 +2645,7 @@ open class PsiRawFirBuilder( explicitReceiver = generateResolvedAccessExpression(rangeSource, iteratorVal) }, typeRef = ktParameter.typeReference.toFirOrImplicitType(), + extractedAnnotations = ktParameter.modifierList?.annotationEntries?.map { it.convert() }, ) if (multiDeclaration != null) { blockBuilder.statements.addDestructuringStatements( diff --git a/compiler/testData/diagnostics/tests/annotations/forParameterAnnotationResolve.fir.kt b/compiler/testData/diagnostics/tests/annotations/forParameterAnnotationResolve.fir.kt index fd63f5b0969..4f1b8c2ef67 100644 --- a/compiler/testData/diagnostics/tests/annotations/forParameterAnnotationResolve.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/forParameterAnnotationResolve.fir.kt @@ -10,5 +10,5 @@ fun foo() { for (@Ann(3) (x, @Ann(4) y) in bar()) {} - for (@Err() (x,y) in bar()) {} + for (@Err() (x,y) in bar()) {} } diff --git a/compiler/testData/diagnostics/tests/annotations/options/forParam.fir.kt b/compiler/testData/diagnostics/tests/annotations/options/forParam.fir.kt deleted file mode 100644 index 54dd273c0e0..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/options/forParam.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -// See KT-9145 - -@Target(AnnotationTarget.CLASS) -annotation class Ann - -fun foo() { - for (@Ann private x in 1..100) { - if (x == 1) return - } -} diff --git a/compiler/testData/diagnostics/tests/annotations/options/forParam.kt b/compiler/testData/diagnostics/tests/annotations/options/forParam.kt index 16d49f5e068..15e1d79aa61 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/forParam.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/forParam.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // See KT-9145 @Target(AnnotationTarget.CLASS)