diff --git a/Foxtrot/Foxtrot/Extraction/ExtractorVisitor.cs b/Foxtrot/Foxtrot/Extraction/ExtractorVisitor.cs index 567340d0..84ddd632 100644 --- a/Foxtrot/Foxtrot/Extraction/ExtractorVisitor.cs +++ b/Foxtrot/Foxtrot/Extraction/ExtractorVisitor.cs @@ -3534,4 +3534,4 @@ public override void VisitMethodCall(MethodCall call) } } } -} \ No newline at end of file +} diff --git a/Microsoft.Research/CCDoc/BooleanExpressionHelper.cs b/Microsoft.Research/CCDoc/BooleanExpressionHelper.cs index 85274739..2afa3d95 100644 --- a/Microsoft.Research/CCDoc/BooleanExpressionHelper.cs +++ b/Microsoft.Research/CCDoc/BooleanExpressionHelper.cs @@ -341,5 +341,23 @@ public override IExpression Rewrite(IConditional conditional) { } return base.Rewrite(conditional); } + + public override IExpression Rewrite(IGreaterThan greaterThan) + { + // Catch use of the x > null idiom used by Roslyn as generated + // code for x != null statements. + if (ExpressionHelper.IsNullLiteral(greaterThan.RightOperand)) + { + var c = new NotEquality + { + LeftOperand = greaterThan.LeftOperand, + RightOperand = greaterThan.RightOperand, + Type = greaterThan.Type + }; + return c; + } + + return base.Rewrite(greaterThan); + } } }