@Nullable
  public static Map<GrExpression, Pair<PsiParameter, PsiType>> mapArgumentsToParameters(@NotNull GroovyResolveResult resolveResult,
                                                                                        @NotNull PsiElement context,
                                                                                        final boolean partial,
                                                                                        final boolean eraseArgs,
                                                                                        final GrNamedArgument @NotNull [] namedArgs,
                                                                                        final GrExpression @NotNull [] expressionArgs,
                                                                                        GrClosableBlock @NotNull [] closureArguments) {
    final GrSignature signature;
    final PsiParameter[] parameters;
    final PsiElement element = resolveResult.getElement();
    PsiSubstitutor substitutor;
    if (resolveResult instanceof GroovyMethodResult) {
      substitutor = ((GroovyMethodResult)resolveResult).getPartialSubstitutor();
    }
    else {
      substitutor = resolveResult.getSubstitutor();
    }
    if (element instanceof PsiMethod) {
      signature = createSignature((PsiMethod)element, substitutor, eraseArgs);
      parameters = ((PsiMethod)element).getParameterList().getParameters();
    }
    else if (element instanceof GrFunctionalExpression) {
      signature = createSignature(((GrFunctionalExpression)element));
      parameters = ((GrFunctionalExpression)element).getAllParameters();
    }
    else {
      return null;
    }

    final ArgInfo<PsiElement>[] argInfos = mapParametersToArguments(signature, namedArgs, expressionArgs, closureArguments, context, partial, eraseArgs);
    if (argInfos == null) {
      return null;
    }

    final Map<GrExpression, Pair<PsiParameter, PsiType>> result = new HashMap<>();
    for (int i = 0; i < argInfos.length; i++) {
      ArgInfo<PsiElement> info = argInfos[i];
      if (info == null) continue;
      for (PsiElement arg : info.args) {
        if (arg instanceof GrNamedArgument) {
          arg = ((GrNamedArgument)arg).getExpression();
        }
        final GrExpression expression = (GrExpression)arg;
        PsiType type = parameters[i].getType();
        if (info.isMultiArg && type instanceof PsiArrayType) {
          type = ((PsiArrayType)type).getComponentType();
        }
        result.put(expression, Pair.create(parameters[i], substitutor.substitute(type)));
      }
    }

    return result;
  }
@Nullable
  public static Map<GrExpression, Pair<PsiParameter, PsiType>> mapArgumentsToParameters(@NotNull GroovyResolveResult resolveResult,
                                                                                        @NotNull PsiElement context,
                                                                                        final boolean partial,
                                                                                        final boolean eraseArgs,
                                                                                        final GrNamedArgument @NotNull [] namedArgs,
                                                                                        final GrExpression @NotNull [] expressionArgs,
                                                                                        GrClosableBlock @NotNull [] closureArguments)