diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/inference/graph/InferenceUnitGraph.kt b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/inference/graph/InferenceUnitGraph.kt index 6a067514c52c..39c824ff38e9 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/inference/graph/InferenceUnitGraph.kt +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/inference/graph/InferenceUnitGraph.kt @@ -49,6 +49,10 @@ data class InferenceUnitGraph(val units: List) { }.forEach { parameter -> units.find { it.type == parameter }?.run { visitTypes(this, visited, order) } } + val parent = unit.parent + if (parent != null) { + visitTypes(parent, visited, order) + } order.add(unit) } } diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/intentions/InferMethodParametersTypesIntentionTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/intentions/InferMethodParametersTypesIntentionTest.groovy index fe2f63d98a3b..dc7952c3002e 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/intentions/InferMethodParametersTypesIntentionTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/intentions/InferMethodParametersTypesIntentionTest.groovy @@ -524,4 +524,8 @@ class AA { static void foo(Integer a) {} } void testCallWithInnerTypeParameter() { doTest(true) } + + void testUnresolvedCode3() { + doTest(true) + } } diff --git a/plugins/groovy/testdata/refactoring/inferMethodParametersTypes/UnresolvedCode3.groovy b/plugins/groovy/testdata/refactoring/inferMethodParametersTypes/UnresolvedCode3.groovy new file mode 100644 index 000000000000..84bbc3eee639 --- /dev/null +++ b/plugins/groovy/testdata/refactoring/inferMethodParametersTypes/UnresolvedCode3.groovy @@ -0,0 +1,5 @@ +def bar(a, b) { + b(a) +} + +bar(unresolved) {} \ No newline at end of file diff --git a/plugins/groovy/testdata/refactoring/inferMethodParametersTypes/UnresolvedCode3_after.groovy b/plugins/groovy/testdata/refactoring/inferMethodParametersTypes/UnresolvedCode3_after.groovy new file mode 100644 index 000000000000..defcfcd2ebb7 --- /dev/null +++ b/plugins/groovy/testdata/refactoring/inferMethodParametersTypes/UnresolvedCode3_after.groovy @@ -0,0 +1,5 @@ +Void bar(Object a, Closure b) { + b(a) +} + +bar(unresolved) {} \ No newline at end of file