Skip to content

Commit b561489

Browse files
committed
Use matching type mapping when translating BoolSwitch
Fixes #34900.
1 parent 9ec3988 commit b561489

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/EFCore.Relational.Specification.Tests/Query/NullSemanticsQueryFixtureBase.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
137137
args => new CaseExpression(
138138
operand: args[0],
139139
[
140-
new CaseWhenClause(new SqlConstantExpression(true, typeMapping: BoolTypeMapping.Default), args[1]),
141-
new CaseWhenClause(new SqlConstantExpression(false, typeMapping: BoolTypeMapping.Default), args[2])
140+
new CaseWhenClause(new SqlConstantExpression(true, typeMapping: args[0].TypeMapping), args[1]),
141+
new CaseWhenClause(new SqlConstantExpression(false, typeMapping: args[0].TypeMapping), args[2])
142142
])));
143143
}
144144

test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3959,8 +3959,8 @@ WHERE CASE CASE
39593959
WHEN [e].[StringA] = N'Foo' THEN CAST(1 AS bit)
39603960
ELSE CAST(0 AS bit)
39613961
END
3962-
WHEN 1 THEN 3
3963-
WHEN 0 THEN 2
3962+
WHEN CAST(1 AS bit) THEN 3
3963+
WHEN CAST(0 AS bit) THEN 2
39643964
END = 2
39653965
""");
39663966
}

0 commit comments

Comments
 (0)