mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
GuessManagerImpl: box values on fast-path; disable DFA on primitive types at all
Fixes IDEA-189340 Does not show Number methods during auto completion
This commit is contained in:
@@ -340,6 +340,9 @@ public class GuessManagerImpl extends GuessManager {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<PsiType> getControlFlowExpressionTypeConjuncts(@NotNull PsiExpression expr) {
|
||||
if (expr.getType() instanceof PsiPrimitiveType) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<PsiType> result = null;
|
||||
PsiExpression place = PsiUtil.skipParenthesizedExprDown(expr);
|
||||
if (place == null) return Collections.emptyList();
|
||||
@@ -413,6 +416,9 @@ public class GuessManagerImpl extends GuessManager {
|
||||
private void handleAssignment(@Nullable PsiExpression expression) {
|
||||
if (expression == null) return;
|
||||
PsiType type = expression.getType();
|
||||
if (type instanceof PsiPrimitiveType) {
|
||||
type = ((PsiPrimitiveType)type).getBoxedType(expression);
|
||||
}
|
||||
PsiType rawType = type instanceof PsiClassType ? ((PsiClassType)type).rawType() : type;
|
||||
if (rawType == null || rawType.equals(PsiType.NULL)) return;
|
||||
if (mySpecificType == null) {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class Foo {
|
||||
void test() {
|
||||
Number x = 10;
|
||||
return x.lon<caret>
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Foo {
|
||||
void test() {
|
||||
Number x = 10;
|
||||
return x.longValue()
|
||||
}
|
||||
}
|
||||
+1
@@ -47,6 +47,7 @@ class NormalCompletionDfaTest extends NormalCompletionTestCase {
|
||||
void testAssignmentTwicePreciseTypeDfa() { doTest() }
|
||||
void testAssignmentParameterDfa() { doTest() }
|
||||
void testAssignmentNoPreciseTypeDfa() { doTest() }
|
||||
void testAssignmentPrimitiveLiteral() { doTest() }
|
||||
void testDeclarationPreciseTypeDfa() { doTest() }
|
||||
void testInstanceOfAssignmentDfa() { doTest() }
|
||||
void testStreamDfa() { doTest() }
|
||||
|
||||
Reference in New Issue
Block a user