mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
switch expressions 2.0: expected type by yield
GitOrigin-RevId: f4e396ddc90d66790db044525611c536c3f620fa
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7e9aad77c7
commit
24d1d27b1e
@@ -371,6 +371,14 @@ public class ExpectedTypesProvider {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitYieldStatement(PsiYieldStatement statement) {
|
||||
PsiSwitchExpression exitedElement = statement.findEnclosingExpression();
|
||||
if (exitedElement != null) {
|
||||
Collections.addAll(myResult, getExpectedTypes(exitedElement, myForCompletion));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMethodCallExpression(@NotNull PsiMethodCallExpression expression) {
|
||||
myExpr = (PsiExpression)myExpr.getParent();
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ class Foo {
|
||||
return switch (i) {
|
||||
default -> {
|
||||
String foo;
|
||||
break foo;
|
||||
yield foo;
|
||||
}
|
||||
};
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@ class Foo {
|
||||
int foo;
|
||||
return switch (foo) {
|
||||
default -> {
|
||||
break i;
|
||||
yield i;
|
||||
}
|
||||
};
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ class Foo {
|
||||
int x = foo ? 0 : switch(1) {
|
||||
default -> {
|
||||
boolean foo;
|
||||
break foo;
|
||||
yield foo;
|
||||
}
|
||||
};
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ class Foo {
|
||||
String test(int i) {
|
||||
return switch (i) {
|
||||
default -> {
|
||||
break fo<caret>o;
|
||||
yield fo<caret>o;
|
||||
}
|
||||
};
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ class Foo {
|
||||
String test(int i) {
|
||||
return switch (f<caret>oo) {
|
||||
default -> {
|
||||
break i;
|
||||
yield i;
|
||||
}
|
||||
};
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
class Foo {
|
||||
int x = foo ? 0 : switch(1) {
|
||||
default -> {
|
||||
break f<caret>oo;
|
||||
yield f<caret>oo;
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user