IDEA-220464 Smart-cast completion doesn't insert <?>

GitOrigin-RevId: 175651a3f6cf5736ca7676b9fe80b569d4260962
This commit is contained in:
peter
2019-09-30 10:32:59 +00:00
committed by intellij-monorepo-bot
parent e3367716c0
commit a0111f91d0
4 changed files with 18 additions and 3 deletions
@@ -1599,9 +1599,6 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
if (checkType != null) {
operand.accept(this);
PsiType type = checkType.getType();
if (type instanceof PsiClassType) {
type = ((PsiClassType)type).rawType();
}
addInstruction(new PushInstruction(myFactory.createTypeValue(type, Nullability.NOT_NULL), null));
addInstruction(new InstanceofInstruction(expression, operand, type));
}
@@ -0,0 +1,8 @@
import java.util.List;
class Foo {
{
Object o;
int size = o instanceof List<?> ? ((List<?>) o).size() : <caret>
}
}
@@ -0,0 +1,8 @@
import java.util.List;
class Foo {
{
Object o;
int size = o instanceof List<?> ? o.size<caret>
}
}
@@ -80,4 +80,6 @@ class SmartTypeCompletionDfaTest extends LightFixtureCompletionTestCase {
void testInstanceofedInsideAnonymous() { doTest() }
void testCastToTypeWithWildcard() { doTest() }
}