Repository navigation
Conversation
|
an [Expressive] enum method whose body the provider cannot translate no longer works through per-value expansion. Remove [Expressive] from such a method to restore it. |
|
I'm not sure how I feel about this one just yet, in my mind its the sensible approach but now things that used to just work (although less effectively) might now break |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🟡 Changes recommended
An active moderate issue causes EXP0033 to report enum-method expansion even though extension-container methods are emitted without expansion, making the diagnostic and generated behavior inconsistent.
1 open issue
What changed in this PR
This PR changes enum method handling so methods marked [Expressive] are emitted as direct calls and subsequently inlined, avoiding unnecessary per-value CASE expressions while preserving provider-friendly predicates.
Changes:
- Skip per-value enum expansion for
[Expressive]methods. - Add
EXP0033diagnostics and an[Expressive]code fix for unmarked enum methods. - Add generator, integration, analyzer, EF SQL, snapshot, and documentation coverage.
| File | Description |
|---|---|
| tests/ExpressiveSharp.IntegrationTests/Tests/StoreQueryTests.cs | Tests nested expressive enum method evaluation in store queries. |
| tests/ExpressiveSharp.IntegrationTests/Scenarios/Store/Models/OrderStatus.cs | Adds an expressive enum predicate backed by a status collection. |
| tests/ExpressiveSharp.IntegrationTests/Scenarios/Store/Models/Order.cs | Adds a nested expressive property that uses the enum predicate. |
| tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/MissingExpressiveDiagnosticTests.cs | Tests EXP0033 reporting and suppression behavior. |
| tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.ExpressiveEnumMethod_IsCalledDirectlyInsteadOfExpanded.verified.txt | Updates the generated-code snapshot for direct expressive enum method calls. |
| tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/EnumTests.cs | Verifies that expressive enum methods are emitted as direct calls. |
| tests/ExpressiveSharp.Generator.Tests/CodeFixers/AddExpressiveCodeFixProviderTests.cs | Tests applying the [Expressive] code fix for EXP0033. |
| tests/ExpressiveSharp.EntityFrameworkCore.IntegrationTests/Infrastructure/ExpressiveExpansionTestBase.cs | Verifies EF SQL avoids per-value enum CASE expansion. |
| src/ExpressiveSharp.Generator/Infrastructure/Diagnostics.cs | Registers EXP0033 in the generator diagnostic documentation. |
| src/ExpressiveSharp.Generator/Emitter/ExpressionTreeEmitter.cs | Bypasses per-value enum expansion for [Expressive] methods. |
| src/ExpressiveSharp.CodeFixers/MissingExpressiveAnalyzer.cs | Adds EXP0033 classification and reporting for unmarked enum methods. |
| src/ExpressiveSharp.CodeFixers/AddExpressiveCodeFixProvider.cs | Enables the [Expressive] code fix for EXP0033. |
| docs/reference/expressive-attribute.md | Documents direct inlining behavior for expressive enum methods. |
| docs/reference/diagnostics.md | Documents EXP0033, its trade-offs, and remediation options. |
| docs/guide/migration-from-projectables.md | Clarifies enum method migration behavior from Projectables. |
| docs/advanced/limitations.md | Updates documentation for enum method expansion limitations. |
| CLAUDE.md | Updates the diagnostic inventory and EXP0033 architecture notes. |
Review effort: Lite
| if (HasEnumReceiver(invokedMethod)) | ||
| descriptor = EnumMethodExpandedPerValue; |

fix: inline [Expressive] enum methods instead of expanding per value
Fixes #111