Repository navigation
Handle implicit numeric literal conversions in query precompilation - #39312
Conversation
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Agent harness evaluation deferredThis PR affects: |
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The focused conversion fix and regression coverage match the stated scope, with no identified blocking issues.
No open issues 🎉
What changed in this PR
Fixes #39303 by converting numeric literal values to their semantic target types before constructing query-precompilation constants.
Changes:
- Handles implicit numeric conversions while preserving null and nonnumeric handling.
- Adds translator regressions and decimal projection generation/managed-compilation coverage.
- Documents validation without query execution or NativeAOT publication.
| File | Description |
|---|---|
| test/EFCore.SqlServer.FunctionalTests/Query/AdHocPrecompiledQuerySqlServerTest.cs | Adds the provider override with an empty SQL assertion. |
| test/EFCore.Relational.Specification.Tests/Query/AdHocPrecompiledQueryRelationalTestBase.cs | Adds the decimal projection compilation regression. |
| test/EFCore.Design.Tests/Query/CSharpToLinqTranslatorTest.cs | Covers decimal, character, widening, and narrowing conversions. |
| src/EFCore.Design/Query/Internal/CSharpToLinqTranslator.cs | Converts numeric values before constructing typed constants. |
| .agents/skills/query-pipeline/SKILL.md | Documents generation-only validation boundaries. |
Review effort: Balanced
Code coverage overviewLanguages: C# C# / code-coverage
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
Query precompilation rejects legal decimal projections such as
group.Balance + (amount > 0 ? amount : 0): it passes a boxed integer literal with a decimal target type toExpression.Constant.