mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
conditional with eq branches: don't push conditional inside type cast for functional expressions, incorrect context will appear otherwise
This commit is contained in:
+3
@@ -781,6 +781,9 @@ public class EquivalenceChecker {
|
||||
}
|
||||
final PsiExpression operand1 = typeCastExpression1.getOperand();
|
||||
final PsiExpression operand2 = typeCastExpression2.getOperand();
|
||||
if (operand1 instanceof PsiFunctionalExpression || operand2 instanceof PsiFunctionalExpression) {
|
||||
return EXACTLY_UN_MATCHES;
|
||||
}
|
||||
return expressionsAreEquivalentDecision(operand1, operand2).setConcreteIfExactUnMatches(operand1, operand2);
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -72,4 +72,10 @@ class ConditionalExpressionWithIdenticalBranches {
|
||||
String a = f ? test(new String[]{"a", "b"}) : test("a");
|
||||
}
|
||||
}
|
||||
|
||||
static class WithFunctionalExpression {
|
||||
private void foo(boolean b) {
|
||||
Runnable r = b ? (Runnable) () -> {} : (Runnable) () -> {};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user