From d31a37f9dc2f07e9d36d7cb566a46e968408539e Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Sat, 8 Jun 2024 18:48:50 +0200 Subject: [PATCH] Remove optimization of `NOT(a != b)` It is implemented incorrectly, namely as if the expression was `NOT(a == b)` and it is currently unused. See https://github.com/dotnet/efcore/pull/23711#pullrequestreview-2105963675 --- .../Internal/SearchConditionConvertingExpressionVisitor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EFCore.SqlServer/Query/Internal/SearchConditionConvertingExpressionVisitor.cs b/src/EFCore.SqlServer/Query/Internal/SearchConditionConvertingExpressionVisitor.cs index b545b77b761..b8987a9ad08 100644 --- a/src/EFCore.SqlServer/Query/Internal/SearchConditionConvertingExpressionVisitor.cs +++ b/src/EFCore.SqlServer/Query/Internal/SearchConditionConvertingExpressionVisitor.cs @@ -67,7 +67,7 @@ private SqlExpression SimplifyNegatedBinary(SqlExpression sqlExpression) && sqlUnaryExpression.Type == typeof(bool) && sqlUnaryExpression.Operand is SqlBinaryExpression { - OperatorType: ExpressionType.Equal or ExpressionType.NotEqual + OperatorType: ExpressionType.Equal } sqlBinaryOperand) { if (sqlBinaryOperand.Left.Type == typeof(bool)