OptionalToIfInspection: propagate rename to nested flatMap

GitOrigin-RevId: ae65a4a91dbefc73bd160a2b92a36e296fed3c3e
This commit is contained in:
Artemiy Sartakov
2020-05-01 09:40:21 +00:00
committed by intellij-monorepo-bot
parent 104cca28f5
commit 349d58606e
3 changed files with 12 additions and 2 deletions
@@ -191,7 +191,7 @@ abstract class IntermediateOperation implements Operation {
static class FlatMap extends IntermediateOperation {
private final List<OperationRecord> myRecords;
private List<OperationRecord> myRecords;
private final String myVarName;
private final FunctionHelper myFn;
@@ -230,7 +230,7 @@ abstract class IntermediateOperation implements Operation {
@Override
public void rename(@NotNull String oldName, @NotNull ChainVariable newVar, @NotNull OptionalToIfContext context) {
myRecords.forEach(r -> r.myOperation.rename(oldName, newVar, context));
myRecords = ContainerUtil.map(myRecords, r -> replaceFnVariable(oldName, r, newVar, context));
}
@Override
@@ -58,6 +58,12 @@ class Test {
}
}
void nestedFlatMapWithOuterFlatMapParam(String param0) {
if (param0 == null) throw new NullPointerException();
String var1 = "foo";
String result = param0;
}
void nestedOr(String param0) {
boolean result;
result = true;
@@ -40,6 +40,10 @@ class Test {
.isPresent();
}
void nestedFlatMapWithOuterFlatMapParam(String param0) {
String result = Optional.of(param0).flatMap(var0 -> Optional.of("foo").flatMap(var1 -> Optional.of(var0))).get();
}
void nestedOr(String param0) {
boolean result;
result = Optional.of(param0)