private static void CheckGetTypeAndTypeOfEquality(ExpressionSyntax sideA, ExpressionSyntax sideB, Location location,
                                                          SyntaxNodeAnalysisContext context)
        {
            if (!TypeExaminationOnSystemType.IsGetTypeCall(sideA as InvocationExpressionSyntax, context.SemanticModel))
            {
                return;
            }

            var typeSyntax = (sideB as TypeOfExpressionSyntax)?.Type;

            if (typeSyntax == null)
            {
                return;
            }

            var typeSymbol = context.SemanticModel.GetTypeInfo(typeSyntax).Type;

            if (typeSymbol == null ||
                !typeSymbol.IsSealed ||
                typeSymbol.OriginalDefinition.Is(KnownType.System_Nullable_T))
            {
                return;
            }

            context.ReportDiagnosticWhenActive(Diagnostic.Create(rule, location, MessageIsOperator));
        }
        private static void CheckForIsAssignableFrom(SyntaxNodeAnalysisContext context, InvocationExpressionSyntax invocation,
                                                     MemberAccessExpressionSyntax memberAccess, IMethodSymbol methodSymbol,
                                                     ExpressionSyntax argument)
        {
            if (methodSymbol.Name != "IsAssignableFrom" ||
                !TypeExaminationOnSystemType.IsGetTypeCall(argument as InvocationExpressionSyntax, context.SemanticModel))
            {
                return;
            }

            if (memberAccess.Expression is TypeOfExpressionSyntax)
            {
                context.ReportDiagnostic(Diagnostic.Create(rule, invocation.GetLocation(),
                                                           ImmutableDictionary <string, string> .Empty
                                                           .Add(UseIsOperatorKey, true.ToString())
                                                           .Add(ShouldRemoveGetType, true.ToString()),
                                                           MessageIsOperator));
            }
            else
            {
                context.ReportDiagnostic(Diagnostic.Create(rule, invocation.GetLocation(),
                                                           ImmutableDictionary <string, string> .Empty
                                                           .Add(UseIsOperatorKey, false.ToString())
                                                           .Add(ShouldRemoveGetType, true.ToString()),
                                                           MessageIsInstanceOfType));
            }
        }
 private static void CheckGetTypeAndTypeOfEquality(ExpressionSyntax sideA, ExpressionSyntax sideB, Location location,
                                                   SyntaxNodeAnalysisContext context)
 {
     if (sideA.ToStringContains("GetType") &&
         sideB is TypeOfExpressionSyntax sideBeTypeOf &&
         sideBeTypeOf.Type is { } typeSyntax&&
         TypeExaminationOnSystemType.IsGetTypeCall(sideA as InvocationExpressionSyntax, context.SemanticModel) &&
         context.SemanticModel.GetTypeInfo(typeSyntax).Type is { } typeSymbol&&
         typeSymbol.IsSealed &&
         !typeSymbol.OriginalDefinition.Is(KnownType.System_Nullable_T))
     {
         context.ReportDiagnosticWhenActive(Diagnostic.Create(rule, location, MessageIsOperator));
     }
 }