@Nullable
  public static PsiType getInferredType(@NotNull final GrReferenceExpression refExpr) {
    final GrControlFlowOwner scope = isFlatDFAAllowed() ? ControlFlowUtils.getTopmostOwner(refExpr) : ControlFlowUtils.findControlFlowOwner(refExpr);
    if (scope == null) return null;

    final GroovyReference rValueReference = refExpr.getRValueReference();
    PsiElement resolve = rValueReference == null ? null : rValueReference.resolve();
    boolean mixinOnly = resolve instanceof GrField && isCompileStatic(refExpr);

    final VariableDescriptor descriptor = createDescriptor(refExpr);
    if (descriptor == null) return null;

    final ReadWriteVariableInstruction rwInstruction = ControlFlowUtils.findRWInstruction(refExpr, getFlatControlFlow(scope).getFlow());
    if (rwInstruction == null) return null;

    final InferenceCache cache = getInferenceCache(scope);

    int descriptorIndex = cache.getGroovyFlow().getIndex(descriptor);
    if (descriptorIndex == 0) return null;

    return cache.getInferredType(descriptorIndex, rwInstruction, mixinOnly);
  }
@Nullable
  public static PsiType getInferredType(@NotNull final GrReferenceExpression refExpr)