int (@NotNull GrSignature signature, @NotNull PsiElement context) { GrClosureParameter[] parameters = signature.getParameters(); boolean isCompileStatic = CompileStaticUtil.isCompileStatic(context); if (parameters.length == 1 && !(parameters[0].getType() instanceof PsiPrimitiveType) && !signature.isCurried() && !isCompileStatic) return 1; int count = 0; for (GrClosureParameter parameter : parameters) { if (parameter.isOptional()) count++; } return count; }