private static boolean containsLocalVar(GroovyResolveResult[] fieldCandidates) {
   boolean preferVar = false;
   if (fieldCandidates.length > 0) {
     for (GroovyResolveResult candidate : fieldCandidates) {
       PsiElement element = candidate.getElement();
       LOG.assertTrue(element != null, candidate);
       if (GroovyRefactoringUtil.isLocalVariable(element)) {
         preferVar = true;
         break;
       }
     }
   }
   return preferVar;
 }
  @Nullable
  public static PsiType checkReassignedVar(
      GrReferenceExpression refExpr, boolean honorCompileStatic) {
    if (honorCompileStatic && !PsiUtil.isCompileStatic(refExpr) || refExpr.getQualifier() != null) {
      return null;
    }

    final PsiElement resolved = refExpr.resolve();
    if (!GroovyRefactoringUtil.isLocalVariable(resolved)) {
      return null;
    }

    assert resolved != null;
    return getLeastUpperBoundByVar((GrVariable) resolved);
  }