Java: Preserve comment from removed redundant variable (IDEA-182669)

This commit is contained in:
Pavel Dolgov
2017-12-06 20:36:00 +03:00
parent 460b7f187d
commit 307a7c774c
5 changed files with 52 additions and 1 deletions
@@ -0,0 +1,8 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int k) {
if (k == 1)
return 1;
return /*comment1*/ -1;
}
}
@@ -0,0 +1,12 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int k) {
if (k == 1)
return 1;
else if (k == 2)
return /*comment1*/ -1;
else if (k == 3)
return 3;
return -1;
}
}
@@ -0,0 +1,9 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int k) {
int n = /*comment1*/-1;
if (k == 1)
n = 1;
<caret>return n;
}
}
@@ -0,0 +1,13 @@
// "Move 'return' closer to computation of the value of 'n'" "true"
class T {
int f(int k) {
int n = /*comment1*/-1;
if (k == 1)
n = 1;
else if (k == 2)
return n;
else if (k == 3)
return 3;
<caret>return n;
}
}