mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
[java-i18n] IDEA-247707 @NonNls inspection doesn't propagate to receiver expressions in Kotlin
GitOrigin-RevId: 77b96c095d076825edb0cab3f5629de52b1611b8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6378aab247
commit
c9b12e1abe
@@ -18,6 +18,19 @@ class KtI18NInspectionTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
""".trimIndent())
|
||||
myFixture.testHighlighting()
|
||||
}
|
||||
|
||||
fun testPropagateToReceiver() {
|
||||
myFixture.enableInspections(com.intellij.codeInspection.i18n.I18nInspection())
|
||||
myFixture.configureByText("Foo.kt", """
|
||||
public fun String.trimIndent(): String = this
|
||||
fun foo(@org.jetbrains.annotations.NonNls <warning descr="[UNUSED_PARAMETER] Parameter 'message' is never used">message</warning>: String) { }
|
||||
fun bar() {
|
||||
foo("foo bar")
|
||||
foo("foo bar".trimIndent())
|
||||
}
|
||||
""".trimIndent())
|
||||
myFixture.testHighlighting()
|
||||
}
|
||||
|
||||
fun testPropertyAssignment() {
|
||||
val inspection = com.intellij.codeInspection.i18n.I18nInspection()
|
||||
|
||||
@@ -352,8 +352,13 @@ public abstract class NlsInfo {
|
||||
UExpression parent = expression;
|
||||
while (true) {
|
||||
UExpression next = ObjectUtils.tryCast(parent.getUastParent(), UExpression.class);
|
||||
if (next == null || next instanceof ULambdaExpression || next instanceof UReturnExpression) return parent;
|
||||
if (next instanceof USwitchClauseExpression || next instanceof UNamedExpression) return parent;
|
||||
if (next == null ||
|
||||
next instanceof ULambdaExpression ||
|
||||
next instanceof UReturnExpression ||
|
||||
next instanceof USwitchClauseExpression ||
|
||||
next instanceof UNamedExpression) {
|
||||
return parent;
|
||||
}
|
||||
if (next instanceof UPolyadicExpression && ((UPolyadicExpression)next).getOperator() != UastBinaryOperator.PLUS) return parent;
|
||||
if (next instanceof UCallExpression) {
|
||||
if (!UastExpressionUtils.isArrayInitializer(next) && !UastExpressionUtils.isNewArrayWithInitializer(next)) {
|
||||
|
||||
@@ -43,5 +43,9 @@ class StringMethods {
|
||||
if (this.getFoo().toLowerCase().equals("bar")) {}
|
||||
}
|
||||
|
||||
void test() {
|
||||
test("foo".trim());
|
||||
}
|
||||
|
||||
@NonNls native String getFoo();
|
||||
}
|
||||
Reference in New Issue
Block a user