private static bool UsesNameOfWrongMember(ReflectedMember member, Name name, SyntaxNodeAnalysisContext context, out Location location, out string nameText)
        {
            if (name.Argument is ArgumentSyntax argument &&
                NameOf.IsNameOf(argument, out var expression))
            {
                if (member.Match == FilterMatch.NoMatch ||
                    (member.Match == FilterMatch.PotentiallyInvisible &&
                     !(member.Symbol is IMethodSymbol)))
                {
                    nameText = $"\"{name.MetadataName}\"";
                    location = argument.GetLocation();
                    return(true);
                }

                if (member.Symbol is ISymbol memberSymbol &&
                    TryGetSymbol(expression, out var symbol) &&
                    !symbol.ContainingType.IsAssignableTo(memberSymbol.ContainingType, context.Compilation) &&
                    NameOf.TryGetExpressionText(member, context, out nameText))
                {
                    location = expression.GetLocation();
                    return(true);
                }
            }

            location = null;
            nameText = null;
            return(false);

            bool TryGetSymbol(ExpressionSyntax e, out ISymbol symbol)
            {
                return(context.SemanticModel.TryGetSymbol(e, context.CancellationToken, out symbol) ||
                       context.SemanticModel.GetSymbolInfo(e, context.CancellationToken)
                       .CandidateSymbols.TryFirst(out symbol));
            }
        }
        private static bool ShouldUseNameof(ReflectedMember member, Name name, SyntaxNodeAnalysisContext context, out Location location, out string nameText)
        {
            if (name.Argument is ArgumentSyntax argument &&
                NameOf.CanUseFor(member.Symbol) &&
                (member.Match == FilterMatch.Single ||
                 member.Match == FilterMatch.Ambiguous ||
                 member.Match == FilterMatch.WrongFlags ||
                 member.Match == FilterMatch.WrongTypes ||
                 (member.Match == FilterMatch.PotentiallyInvisible && member.Symbol is IMethodSymbol)))
            {
                if (argument.Expression is LiteralExpressionSyntax literal &&
                    literal.IsKind(SyntaxKind.StringLiteralExpression) &&
                    NameOf.TryGetExpressionText(member, context, out var expressionText) &&
                    !expressionText.StartsWith("\"", StringComparison.OrdinalIgnoreCase))
                {
                    nameText = $"nameof({expressionText})";
                    location = literal.GetLocation();
                    return(true);
                }
            }

            location = null;
            nameText = null;
            return(false);
        }