java: yield/break completion + migrate tests to java 13

GitOrigin-RevId: 229f13e7dd85154e63754f82f4b44bbcbca67a40
This commit is contained in:
Anna Kozlova
2019-07-02 06:52:16 +03:00
committed by intellij-monorepo-bot
parent 86c773e12a
commit 196b7a83a3
6 changed files with 10 additions and 9 deletions
@@ -775,8 +775,9 @@ public class JavaKeywordCompletion {
addKeyword(br);
}
else if (psiElement().inside(PsiSwitchExpression.class).accepts(myPosition)) {
addKeyword(TailTypeDecorator.withTail(br, TailType.INSERT_SPACE));
addKeyword(TailTypeDecorator.withTail(createKeyword(PsiKeyword.YIELD), TailType.INSERT_SPACE));
addKeyword(TailTypeDecorator.withTail(PsiUtil.getLanguageLevel(myPosition) == LanguageLevel.JDK_12_PREVIEW
? createKeyword(PsiKeyword.BREAK)
: createKeyword(PsiKeyword.YIELD), TailType.INSERT_SPACE));
}
for (PsiLabeledStatement labeled : psiApi().parents(myPosition).takeWhile(notInstanceOf(PsiMember.class)).filter(PsiLabeledStatement.class)) {
@@ -2,7 +2,7 @@ public class ConstConfig {
int test(int x) {
return switch (x) {
case 1:
if (Math.random() > 0.5) br<caret>
if (Math.random() > 0.5) yi<caret>
};
}
}
@@ -2,7 +2,7 @@ public class ConstConfig {
int test(int x) {
return switch (x) {
case 1:
if (Math.random() > 0.5) break <caret>
if (Math.random() > 0.5) yield <caret>
};
}
}
@@ -3,9 +3,9 @@ public class ConstConfig {
Boolean b;
if ((b = switch (0) {
case 1: {
break aaaa<caret>;
yield aaaa<caret>;
}
default: break false;
default: yield false;
}));
}
}
@@ -3,9 +3,9 @@ public class ConstConfig {
Boolean b;
if ((b = switch (0) {
case 1: {
break aaaaaaaa<caret>;
yield aaaaaaaa<caret>;
}
default: break false;
default: yield false;
}));
}
}
@@ -12,7 +12,7 @@ class Normal12CompletionTest extends NormalCompletionTestCase {
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_12
return JAVA_13
}
void testDefaultInRuleSwitch() throws Throwable { doTest() }