fix SOE in G++ type inference

This commit is contained in:
peter
2010-08-04 08:12:39 +01:00
parent f9ae7a911e
commit c59e600b8f
2 changed files with 19 additions and 2 deletions
@@ -47,9 +47,9 @@ public class GppExpectedTypesContributor extends GroovyExpectedTypesContributor
assert argIndex >= 0;
final ArrayList<TypeConstraint> result = new ArrayList<TypeConstraint>();
for (PsiType type : GroovyExpectedTypesProvider.getDefaultExpectedTypes(expression)) {
for (PsiType type : GroovyExpectedTypesProvider.getDefaultExpectedTypes(list)) {
if (type instanceof PsiClassType) {
for (GroovyResolveResult resolveResult : PsiUtil.getConstructorCandidates((PsiClassType)type, argTypes, expression)) {
for (GroovyResolveResult resolveResult : PsiUtil.getConstructorCandidates((PsiClassType)type, argTypes, list)) {
final PsiElement method = resolveResult.getElement();
if (method instanceof PsiMethod && ((PsiMethod)method).isConstructor()) {
final PsiParameter[] constructorParameters = ((PsiMethod)method).getParameterList().getParameters();
@@ -424,6 +424,23 @@ s.do<caret>Smth()
@Typed File foo() { ['super':['a']] }
@Typed File goo() { <warning descr="Cannot assign 'Map' to 'File'">[:]</warning> }
File bar() { <warning descr="Cannot assign 'Map' to 'File'">[:]</warning> }
"""
myFixture.enableInspections new GroovyAssignabilityCheckInspection()
myFixture.checkHighlighting(true, false, false)
}
public void testNestedLiteralConstructors() throws Exception {
configureGppScript """
class Foo {
def Foo(Bar b) { }
}
class Bar {
def Bar(int i) { }
}
Foo x = [[2]]
println x
"""
myFixture.enableInspections new GroovyAssignabilityCheckInspection()
myFixture.checkHighlighting(true, false, false)