[java-inspections] IDEA-287311 Bug: Inspection 'bring variable into scope' introduces Compilation error when used with 'var'

GitOrigin-RevId: 85f7f526ec1cee6533f441bf42bc43b1b0bb8be1
This commit is contained in:
Tagir Valeev
2022-01-27 13:14:41 +07:00
committed by intellij-monorepo-bot
parent eea5b2207e
commit c7ed6477fb
3 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
// "Bring 'String msg' into scope" "true"
public class BringVarIntoScope {
public void moveVariableDeclarationOutOfBlock(boolean b) {
String msg;
if (b) {
msg = "Leap year";
} else {
msg = "Not a leap year";
}
}
}

View File

@@ -0,0 +1,10 @@
// "Bring 'String msg' into scope" "true"
public class BringVarIntoScope {
public void moveVariableDeclarationOutOfBlock(boolean b) {
if (b) {
var msg = "Leap year";
} else {
<caret>msg = "Not a leap year";
}
}
}