boolean (PsiExpression expression, PsiVariable variable) { if (variable == null) return false; expression = PsiUtil.skipParenthesizedExprDown(expression); if (!(expression instanceof PsiReferenceExpression ref)) return false; if ((variable instanceof PsiLocalVariable || variable instanceof PsiParameter) && ref.isQualified()) { // Optimization: references to locals and parameters are unqualified return false; } return ref.isReferenceTo(variable); }