IDEA-56950 IDEA doesn't consider types int and Integer as identical

This commit is contained in:
Maxim Medvedev
2010-07-30 16:40:05 +04:00
parent a5dd325253
commit 586f95367c
8 changed files with 24 additions and 5 deletions
@@ -103,7 +103,8 @@ public class TypesUtil {
if (candidates.length == 1) {
final PsiElement element = candidates[0].getElement();
if (element instanceof PsiMethod) {
return candidates[0].getSubstitutor().substitute(PsiUtil.getSmartReturnType((PsiMethod)element));
return boxPrimitiveType(candidates[0].getSubstitutor().substitute(PsiUtil.getSmartReturnType((PsiMethod)element)),
place.getManager(), place.getResolveScope());
}
}
return null;
@@ -102,12 +102,13 @@ public class GrIndexPropertyImpl extends GrExpressionImpl implements GrIndexProp
componentType = TypesUtil.boxPrimitiveType(((PsiArrayType)thisType).getComponentType(), getManager(), getResolveScope());
}
else if (InheritanceUtil.isInheritor(thisType, CommonClassNames.JAVA_UTIL_MAP) && argTypes.length == 1) {
componentType = substituteTypeParameter(thisType, CommonClassNames.JAVA_UTIL_MAP, 1, true);
componentType = TypesUtil
.boxPrimitiveType(substituteTypeParameter(thisType, CommonClassNames.JAVA_UTIL_MAP, 1, true), getManager(), getResolveScope());
}
if (overloadedOperatorType != null &&
(componentType == null || !TypesUtil.isAssignable(overloadedOperatorType, componentType, getManager(), getResolveScope()))) {
return overloadedOperatorType;
return TypesUtil.boxPrimitiveType(overloadedOperatorType, getManager(), getResolveScope());
}
return componentType;
}
@@ -230,4 +230,7 @@ public class GroovyCompletionTest extends GroovyCompletionTestBase {
"}");
doSmartTest();
}
}
public void testIntCompletionInPlusMethod() {doBasicTest();}
public void testIntCompletionInGenericParameter() {doBasicTest();}
}
@@ -31,7 +31,7 @@ abstract public class GroovyCompletionTestBase extends LightCodeInsightFixtureTe
myFixture.checkResultByFile(getTestName(false) + "_after.groovy", true);
}
protected void doBasicTest() throws Exception {
protected void doBasicTest() {
myFixture.testCompletion(getTestName(false) + ".groovy", getTestName(false) + "_after.groovy");
}
@@ -0,0 +1,2 @@
List<int> list
list.get(0).intV<caret>
@@ -0,0 +1,2 @@
List<int> list
list.get(0).intValue()
@@ -0,0 +1,5 @@
class X {
int plus(X x) {}
}
(new X()+new X()).intV<caret>
@@ -0,0 +1,5 @@
class X {
int plus(X x) {}
}
(new X()+new X()).intValue()