boolean (PsiVariable var, ResolveState state) { if (var instanceof PsiField && !resolveHelper.isAccessible((PsiField)var, list, null)) return false; if (var instanceof GrVariable && PsiUtil.isLocalVariable(var) && list.getTextRange().getStartOffset() <= var.getTextRange().getStartOffset()) { return false; } if (PsiTreeUtil.isAncestor(var, list, false)) return false; final PsiType _type = var instanceof GrVariable ? ((GrVariable)var).getTypeGroovy() : var.getType(); final PsiType varType = state.get(PsiSubstitutor.KEY).substitute(_type); return type.isAssignableFrom(varType); }