[java-parser] IDEA-332589 Support when as identifier in patterns

- allow to use `when` after type test patterns. Deconstruction pattern is supposed to have when as keyword afterward

GitOrigin-RevId: 4c385125385238f9ea69bc8f69279e8900a2a9e5
This commit is contained in:
Mikhail Pyltsin
2023-09-18 12:38:47 +02:00
committed by intellij-monorepo-bot
parent 2f980484c8
commit 9fed3df3e2
13 changed files with 312 additions and 32 deletions

View File

@@ -157,6 +157,10 @@ public abstract class AbstractBasicStatementParserTest extends AbstractBasicJava
public void testSwitchRulesWithPattern6() { doParserTest("case Integer i when true -> { }"); }
public void testSwitchRulesWithPattern7() { doParserTest("case R(int i) when true -> {}"); }
public void testSwitchRulesWithPattern8() { doParserTest("case R(int i) when a < b -> {}"); }
public void testSwitchRulesWithPattern9() { doParserTest("case A when when when.foo() -> {}"); }
public void testSwitchRulesWithPattern10() { doParserTest("case when(boolean when) when when -> {}"); }
public void testSwitchRulesWithPattern11() { doParserTest("case when when when when(when) -> {}"); }
public void testSwitchRulesWithPattern12() { doParserTest("case when when -> {}"); }
public void testSwitchRulesWithPatternIncomplete1() { doParserTest("case (Integer i -> { }"); }
public void testSwitchRulesWithPatternIncomplete2() { doParserTest("case Integer i, -> { }"); }
public void testSwitchRulesWithPatternIncomplete3() { doParserTest("case Integer i when -> { }"); }

View File

@@ -11,6 +11,8 @@ public abstract class AbstractBasicSwitchParsingTest extends AbstractBasicJavaPa
}
public void testNormal() { doTest(true); }
public void testNormalManyWhen() { doTest(true); }
public void testUncomplete1() { doTest(true); }
public void testUncomplete2() { doTest(true); }