fix regression with incorrect type resolving for closure parameter

GitOrigin-RevId: 53b552039bfab2d51ebcd102eee6459d6730e27e
This commit is contained in:
Konstantin.Nisht
2019-10-09 14:08:11 +00:00
committed by intellij-monorepo-bot
parent a50343a2d3
commit 93c84a43d9
2 changed files with 5 additions and 5 deletions
@@ -1,6 +1,7 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.intentions.style.inference
import com.intellij.openapi.util.RecursionManager
import com.intellij.openapi.util.component1
import com.intellij.openapi.util.component2
import com.intellij.psi.*
@@ -29,11 +30,10 @@ class CollectingGroovyInferenceSession(
companion object {
fun getContextSubstitutor(resolveResult: GroovyMethodResult,
nearestCall: GrCall): PsiSubstitutor {
nearestCall: GrCall): PsiSubstitutor = RecursionManager.doPreventingRecursion(resolveResult, true) {
val collectingSession = CollectingGroovyInferenceSession(nearestCall.parentOfType<GrMethod>()!!.typeParameters, nearestCall)
return buildTopLevelSession(nearestCall, collectingSession).inferSubst(resolveResult)
}
buildTopLevelSession(nearestCall, collectingSession).inferSubst(resolveResult)
} ?: PsiSubstitutor.EMPTY
}
private fun substituteForeignTypeParameters(type: PsiType?): PsiType? {
@@ -66,7 +66,7 @@ class InferredClosureParamsEnhancer : AbstractClosureParameterEnhancer() {
val session = CollectingGroovyInferenceSession(virtualMethod.typeParameters, virtualMethod, resolveResult.contextSubstitutor,
proxyMapping)
session.addConstraint(MethodCallConstraint(null, resolveResult, virtualMethod))
return session.inferSubst(resolveResult)
return session.inferSubst()
}
}