Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/switchExpressions/DeeplyNested.java
T
Tagir Valeevandintellij-monorepo-bot acca78a03f IDEA-388530 [java-psi] False 'Ambiguous method call' error with nested switch expressions
During overload resolution, we temporarily fix parent type and check if the parent method is applicable. In this case, we should still check the assignability between the parent type and the result types. It's implemented similarly in PsiConditionalExpressionImpl.getType

GitOrigin-RevId: 08ae1f3f900c1db01d817c9fc52fcfc03aec89f3
2026-04-30 12:08:48 +00:00

26 lines
510 B
Java

class X {
class A {
A a;
}
void main() {
A a = new A();
a.a = a;
System.out.println(switch (a) {
case null -> null;
case A b -> switch (b.a) {
case null -> null;
case A c -> switch (c.a) {
case null -> null;
case A d -> switch (d.a) {
case null -> null;
case A e -> switch (e.a) {
case A f -> f.toString();
case null -> null;
};
};
};
};
});
}
}