calc expected type on the left of assignment based on standalone expression type from the right side (IDEA-199273)

This commit is contained in:
Anna.Kozlova
2019-02-07 15:58:10 +01:00
parent 43434ac2b4
commit a98a18ce8a
3 changed files with 15 additions and 1 deletions

View File

@@ -567,7 +567,7 @@ public class ExpectedTypesProvider {
PsiExpression rExpr = assignment.getRExpression();
if (rExpr != null) {
PsiType type = rExpr.getType();
PsiType type = MethodCandidateInfo.ourOverloadGuard.doPreventingRecursion(assignment, false, () -> rExpr.getType());
if (type != null && type != PsiType.NULL) {
if (type instanceof PsiClassType) {
final PsiClass resolved = ((PsiClassType)type).resolve();

View File

@@ -0,0 +1,7 @@
// "Create local variable 't'" "true"
class Test {
private void f(boolean f) {
String t = f ? null : "";
}
}

View File

@@ -0,0 +1,7 @@
// "Create local variable 't'" "true"
class Test {
private void f(boolean f) {
<caret>t = f ? null : "";
}
}