diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/gpp/GppExpectedTypesContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/gpp/GppExpectedTypesContributor.java index 5937224292b1..2a59c0f12b6f 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/gpp/GppExpectedTypesContributor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/gpp/GppExpectedTypesContributor.java @@ -47,9 +47,9 @@ public class GppExpectedTypesContributor extends GroovyExpectedTypesContributor assert argIndex >= 0; final ArrayList result = new ArrayList(); - 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(); diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GppFunctionalTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GppFunctionalTest.groovy index 0b6592de7fb8..9dc6436c8373 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GppFunctionalTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GppFunctionalTest.groovy @@ -424,6 +424,23 @@ s.doSmth() @Typed File foo() { ['super':['a']] } @Typed File goo() { [:] } File bar() { [:] } +""" + 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)