mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Introduce pattern variable: fixed when occurrence inside another local var declaration
GitOrigin-RevId: fe52fb94fcac26bee951df0f6aaa2e8b32fba95d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bbd7f0443f
commit
c76e1b4108
+8
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
void test(Object obj) {
|
||||
if (obj instanceof String temp) {
|
||||
String s = temp.trim();
|
||||
System.out.println("Found");
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
void test(Object obj) {
|
||||
if (obj instanceof String) {
|
||||
String s = (<selection>(String)obj</selection>).trim();
|
||||
System.out.println("Found");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,7 @@ public class IntroduceVariableTest extends LightJavaCodeInsightTestCase {
|
||||
doTest("temp", true, false, false, "boolean");
|
||||
}
|
||||
public void testPatternVariableDeclarationJava14Preview() { doTest("temp", true, false, false, JAVA_LANG_STRING);}
|
||||
public void testPatternVariableDeclarationUsedInLocalJava14Preview() { doTest("temp", true, false, false, JAVA_LANG_STRING);}
|
||||
public void testPatternVariableDeclarationAfterIfJava14Preview() { doTest("temp", true, false, false, JAVA_LANG_STRING);}
|
||||
public void testNonPatternDeclarationJava14Preview() { doTest("temp", true, false, false, JAVA_LANG_STRING);}
|
||||
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ public class InstanceOfUtils {
|
||||
}
|
||||
}
|
||||
if ((context instanceof PsiExpression && !(context instanceof PsiLambdaExpression)) ||
|
||||
context instanceof PsiExpressionList) {
|
||||
context instanceof PsiExpressionList || context instanceof PsiLocalVariable) {
|
||||
context = context.getParent();
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user