Commit 5fe4a9b6 authored by Tagir Valeev's avatar Tagir Valeev
Browse files

GuessManagerImpl: box values on fast-path; disable DFA on primitive types at all

Fixes IDEA-189340 Does not show Number methods during auto completion
parent c2e61e86
Showing with 19 additions and 0 deletions
+19 -0
...@@ -340,6 +340,9 @@ public class GuessManagerImpl extends GuessManager { ...@@ -340,6 +340,9 @@ public class GuessManagerImpl extends GuessManager {
@NotNull @NotNull
@Override @Override
public List<PsiType> getControlFlowExpressionTypeConjuncts(@NotNull PsiExpression expr) { public List<PsiType> getControlFlowExpressionTypeConjuncts(@NotNull PsiExpression expr) {
if (expr.getType() instanceof PsiPrimitiveType) {
return Collections.emptyList();
}
List<PsiType> result = null; List<PsiType> result = null;
PsiExpression place = PsiUtil.skipParenthesizedExprDown(expr); PsiExpression place = PsiUtil.skipParenthesizedExprDown(expr);
if (place == null) return Collections.emptyList(); if (place == null) return Collections.emptyList();
...@@ -413,6 +416,9 @@ public class GuessManagerImpl extends GuessManager { ...@@ -413,6 +416,9 @@ public class GuessManagerImpl extends GuessManager {
private void handleAssignment(@Nullable PsiExpression expression) { private void handleAssignment(@Nullable PsiExpression expression) {
if (expression == null) return; if (expression == null) return;
PsiType type = expression.getType(); PsiType type = expression.getType();
if (type instanceof PsiPrimitiveType) {
type = ((PsiPrimitiveType)type).getBoxedType(expression);
}
PsiType rawType = type instanceof PsiClassType ? ((PsiClassType)type).rawType() : type; PsiType rawType = type instanceof PsiClassType ? ((PsiClassType)type).rawType() : type;
if (rawType == null || rawType.equals(PsiType.NULL)) return; if (rawType == null || rawType.equals(PsiType.NULL)) return;
if (mySpecificType == null) { if (mySpecificType == null) {
......
class Foo {
void test() {
Number x = 10;
return x.lon<caret>
}
}
class Foo {
void test() {
Number x = 10;
return x.longValue()
}
}
...@@ -47,6 +47,7 @@ class NormalCompletionDfaTest extends NormalCompletionTestCase { ...@@ -47,6 +47,7 @@ class NormalCompletionDfaTest extends NormalCompletionTestCase {
void testAssignmentTwicePreciseTypeDfa() { doTest() } void testAssignmentTwicePreciseTypeDfa() { doTest() }
void testAssignmentParameterDfa() { doTest() } void testAssignmentParameterDfa() { doTest() }
void testAssignmentNoPreciseTypeDfa() { doTest() } void testAssignmentNoPreciseTypeDfa() { doTest() }
void testAssignmentPrimitiveLiteral() { doTest() }
void testDeclarationPreciseTypeDfa() { doTest() } void testDeclarationPreciseTypeDfa() { doTest() }
void testInstanceOfAssignmentDfa() { doTest() } void testInstanceOfAssignmentDfa() { doTest() }
void testStreamDfa() { doTest() } void testStreamDfa() { doTest() }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment