[java] [switch expressions] avoid dbl work when checking types of switch return expressions

IJ-CR-14340

GitOrigin-RevId: 40e79767d794f7b7fcc9bc4d3930051a1698ea86
This commit is contained in:
Anna Kozlova
2021-09-28 19:15:38 +02:00
committed by intellij-monorepo-bot
parent 3434af89eb
commit 49edf8a29d
3 changed files with 19 additions and 12 deletions

View File

@@ -110,6 +110,10 @@ class MyTest {
case 0 -> 42;
default -> <error descr="Expression type should not be 'void'">System.out.println(42)</error>;
};
<error descr="Cannot infer type: variable initializer is 'null'">var</error> rv1 = switch (0) {
default -> null;
};
}
static void test(boolean b, int i) {