From d22cc01638e925e68266d16ec2e7b66fadbc0650 Mon Sep 17 00:00:00 2001 From: Roman Efremov Date: Fri, 26 Jan 2024 16:39:23 +0100 Subject: [PATCH] [LightTree] Stop reporting NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER on ...local properties to make it similar to PSI. See this logic in `org.jetbrains.kotlin.fir.builder.PsiRawFirBuilder.Visitor.toFirProperty` ^KT-62704 --- .../converter/LightTreeRawFirDeclarationBuilder.kt | 4 +++- .../local-variables/type-parameters/neg/1.fir.kt | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt index e73360a418f..abafe90a822 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt @@ -1456,7 +1456,9 @@ class LightTreeRawFirDeclarationBuilder( contextReceivers.addAll(convertContextReceivers(property)) }.also { - fillDanglingConstraintsTo(firTypeParameters, typeConstraints, it) + if (!isLocal) { + fillDanglingConstraintsTo(firTypeParameters, typeConstraints, it) + } } } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/local-variables/type-parameters/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/local-variables/type-parameters/neg/1.fir.kt index e86ede1d679..0b7b2fc894d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/local-variables/type-parameters/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/local-variables/type-parameters/neg/1.fir.kt @@ -32,8 +32,8 @@ fun case_3() { // TESTCASE NUMBER: 4 fun case_4() { - val y1: Number where __UNRESOLVED__: __UNRESOLVED__ = 1 - var y2: Number where __UNRESOLVED__: __UNRESOLVED__ = 1 + val y1: Number where __UNRESOLVED__: __UNRESOLVED__ = 1 + var y2: Number where __UNRESOLVED__: __UNRESOLVED__ = 1 } // TESTCASE NUMBER: 5 @@ -94,8 +94,8 @@ fun case_12() { // TESTCASE NUMBER: 13 fun case_13() { - val __UNRESOLVED__> x: Int where __UNRESOLVED__: __UNRESOLVED__ - var __UNRESOLVED__> x: Int where __UNRESOLVED__: __UNRESOLVED__ + val __UNRESOLVED__> x: Int where __UNRESOLVED__: __UNRESOLVED__ + var __UNRESOLVED__> x: Int where __UNRESOLVED__: __UNRESOLVED__ } // TESTCASE NUMBER: 14