Skip to content

Commit 775db94

Browse files
lunakolySpace Team
authored andcommitted
[FIR] Downgrade some extra checkers to experimentals
- `EmptyRangeChecker.kt` - inaccurate: compares function names as strings - has false positives on user-defined functions - `RedundantInterpolationPrefixChecker.kt` - inaccurate: I'm not sure I trust the specified regex, especially in the case of multidollar interpolation - it also describes some strange `$` followed by \` and then non-\`s ^KT-69938
1 parent d40f0b9 commit 775db94

10 files changed

+26
-17
lines changed

compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ExperimentalExpressionCheckers.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
55

66
package org.jetbrains.kotlin.fir.analysis.checkers
77

8+
import org.jetbrains.kotlin.fir.analysis.checkers.experimental.*
89
import org.jetbrains.kotlin.fir.analysis.checkers.expression.*
910

10-
object ExperimentalExpressionCheckers : ExpressionCheckers()
11+
object ExperimentalExpressionCheckers : ExpressionCheckers() {
12+
override val functionCallCheckers: Set<FirFunctionCallChecker>
13+
get() = setOf(
14+
EmptyRangeChecker,
15+
)
16+
17+
override val stringConcatenationCallCheckers: Set<FirStringConcatenationCallChecker>
18+
get() = setOf(
19+
RedundantInterpolationPrefixCheckerConcatenation,
20+
)
21+
22+
override val literalExpressionCheckers: Set<FirLiteralExpressionChecker>
23+
get() = setOf(
24+
RedundantInterpolationPrefixCheckerLiteral,
25+
)
26+
}

compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/ExtraExpressionCheckers.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,11 @@ object ExtraExpressionCheckers : ExpressionCheckers() {
2727

2828
override val functionCallCheckers: Set<FirFunctionCallChecker>
2929
get() = setOf(
30-
EmptyRangeChecker,
3130
PlatformClassMappedToKotlinConstructorCallChecker,
3231
)
3332

3433
override val stringConcatenationCallCheckers: Set<FirStringConcatenationCallChecker>
3534
get() = setOf(
3635
RedundantSingleExpressionStringTemplateChecker,
37-
RedundantInterpolationPrefixCheckerConcatenation,
38-
)
39-
40-
override val literalExpressionCheckers: Set<FirLiteralExpressionChecker>
41-
get() = setOf(
42-
RedundantInterpolationPrefixCheckerLiteral,
4336
)
4437
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
2-
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
2+
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
44
*/
55

6-
package org.jetbrains.kotlin.fir.analysis.checkers.extra
6+
package org.jetbrains.kotlin.fir.analysis.checkers.experimental
77

88
import org.jetbrains.kotlin.KtFakeSourceElementKind
99
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
44
*/
55

6-
package org.jetbrains.kotlin.fir.analysis.checkers.extra
6+
package org.jetbrains.kotlin.fir.analysis.checkers.experimental
77

88
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
99
import org.jetbrains.kotlin.diagnostics.reportOn

compiler/testData/diagnostics/tests/EnabledMultiDollarInterpolation.fir.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// LANGUAGE: +MultiDollarInterpolation
2-
// WITH_EXTRA_CHECKERS
2+
// WITH_EXPERIMENTAL_CHECKERS
33
// DIAGNOSTICS: -warnings +REDUNDANT_INTERPOLATION_PREFIX
44
// WITH_STDLIB
55

compiler/testData/diagnostics/tests/EnabledMultiDollarInterpolation.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// LANGUAGE: +MultiDollarInterpolation
2-
// WITH_EXTRA_CHECKERS
2+
// WITH_EXPERIMENTAL_CHECKERS
33
// DIAGNOSTICS: -warnings +REDUNDANT_INTERPOLATION_PREFIX
44
// WITH_STDLIB
55

compiler/testData/diagnostics/tests/IncorrectMultiDollarInterpolationCodeA.fir.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// LANGUAGE: +MultiDollarInterpolation
2-
// WITH_EXTRA_CHECKERS
2+
// WITH_EXPERIMENTAL_CHECKERS
33
// DIAGNOSTICS: -warnings +REDUNDANT_INTERPOLATION_PREFIX
44
// WITH_STDLIB
55

compiler/testData/diagnostics/tests/IncorrectMultiDollarInterpolationCodeA.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// LANGUAGE: +MultiDollarInterpolation
2-
// WITH_EXTRA_CHECKERS
2+
// WITH_EXPERIMENTAL_CHECKERS
33
// DIAGNOSTICS: -warnings +REDUNDANT_INTERPOLATION_PREFIX
44
// WITH_STDLIB
55

compiler/testData/diagnostics/tests/IncorrectPaddedMultiDollarInterpolationCodeA.fir.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// LANGUAGE: +MultiDollarInterpolation
2-
// WITH_EXTRA_CHECKERS
2+
// WITH_EXPERIMENTAL_CHECKERS
33
// DIAGNOSTICS: -warnings +REDUNDANT_INTERPOLATION_PREFIX
44
// WITH_STDLIB
55

compiler/testData/diagnostics/tests/IncorrectPaddedMultiDollarInterpolationCodeA.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// LANGUAGE: +MultiDollarInterpolation
2-
// WITH_EXTRA_CHECKERS
2+
// WITH_EXPERIMENTAL_CHECKERS
33
// DIAGNOSTICS: -warnings +REDUNDANT_INTERPOLATION_PREFIX
44
// WITH_STDLIB
55

0 commit comments

Comments
 (0)