Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and enable Bitwise_and_on_expression_with_like_and_null_check_being_compared_to_false #33872

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.EntityFrameworkCore.TestModels.Operators;
Expand Down Expand Up @@ -30,7 +30,7 @@ protected virtual Task Seed(OperatorsContext ctx)
return ctx.SaveChangesAsync();
}

[ConditionalFact(Skip = "issue #30245")]
[ConditionalFact]
public virtual async Task Bitwise_and_on_expression_with_like_and_null_check_being_compared_to_false()
{
var contextFactory = await InitializeAsync<OperatorsContext>(seed: Seed);
Expand All @@ -40,6 +40,7 @@ public virtual async Task Bitwise_and_on_expression_with_like_and_null_check_bei
from o2 in ExpectedData.OperatorEntitiesString
from o3 in ExpectedData.OperatorEntitiesBool
where ((o2.Value == "B" || o3.Value) & (o1.Value != null))
orderby o1.Id, o2.Id, o3.Id
select new
{
Value1 = o1.Value,
Expand All @@ -51,6 +52,7 @@ from o3 in ExpectedData.OperatorEntitiesBool
from o2 in context.Set<OperatorEntityString>()
from o3 in context.Set<OperatorEntityBool>()
where ((EF.Functions.Like(o2.Value, "B") || o3.Value) & (o1.Value != null)) != false
orderby o1.Id, o2.Id, o3.Id
select new
{
Value1 = o1.Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ public override async Task Bitwise_and_on_expression_with_like_and_null_check_be
{
await base.Bitwise_and_on_expression_with_like_and_null_check_being_compared_to_false();

AssertSql("");
AssertSql(
"""
SELECT [o].[Value] AS [Value1], [o0].[Value] AS [Value2], [o1].[Value] AS [Value3]
FROM [OperatorEntityString] AS [o]
CROSS JOIN [OperatorEntityString] AS [o0]
CROSS JOIN [OperatorEntityBool] AS [o1]
WHERE (([o0].[Value] LIKE N'B' AND [o0].[Value] IS NOT NULL) OR [o1].[Value] = CAST(1 AS bit)) AND [o].[Value] IS NOT NULL
ORDER BY [o].[Id], [o0].[Id], [o1].[Id]
""");
}

public override async Task Complex_predicate_with_bitwise_and_modulo_and_negation()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ public override async Task Bitwise_and_on_expression_with_like_and_null_check_be
{
await base.Bitwise_and_on_expression_with_like_and_null_check_being_compared_to_false();

AssertSql("");
AssertSql(
"""
SELECT "o"."Value" AS "Value1", "o0"."Value" AS "Value2", "o1"."Value" AS "Value3"
FROM "OperatorEntityString" AS "o"
CROSS JOIN "OperatorEntityString" AS "o0"
CROSS JOIN "OperatorEntityBool" AS "o1"
WHERE (("o0"."Value" LIKE 'B' AND "o0"."Value" IS NOT NULL) OR "o1"."Value") AND "o"."Value" IS NOT NULL
ORDER BY "o"."Id", "o0"."Id", "o1"."Id"
""");
}

public override async Task Complex_predicate_with_bitwise_and_modulo_and_negation()
Expand Down