Skip to content

Allow virtual expressive members but warn; added documentation on the restriction as well as a suggested workaround#66

Merged
koenbeuk merged 2 commits into
mainfrom
feat/virtual-expressive-members
Jun 1, 2026
Merged

Allow virtual expressive members but warn; added documentation on the restriction as well as a suggested workaround#66
koenbeuk merged 2 commits into
mainfrom
feat/virtual-expressive-members

Conversation

@koenbeuk
Copy link
Copy Markdown
Collaborator

@koenbeuk koenbeuk commented Jun 1, 2026

No description provided.

… restriction as well as a suggested workaround
Copilot AI review requested due to automatic review settings June 1, 2026 00:47
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/ExpressiveSharp/Services/ExpressiveReplacer.cs 60.00% 0 Missing and 2 partials ⚠️
...c/ExpressiveSharp.Generator/ExpressiveGenerator.cs 80.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request changes ExpressiveSharp’s behavior around virtual/override [Expressive] members: virtual members are now expanded (using the receiver’s static/declared type) while emitting a new warning (EXP0038) to document the loss of polymorphic dispatch. It also adds test coverage and documentation explaining the limitation and recommended workarounds.

Changes:

  • Remove the runtime “polymorphic dispatch gate” during expression replacement so virtual [Expressive] members can still be expanded for query providers.
  • Add generator warning EXP0038 for virtual/abstract/override expressive members, plus new docs describing the limitation and workarounds.
  • Add/adjust integration and generator tests to validate expansion behavior and the new diagnostic.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/ExpressiveSharp.IntegrationTests/Tests/ExpansionEdgeCasesTests.cs Updates virtual dispatch expansion test expectations; adds local EXP0038 suppression for test types.
tests/ExpressiveSharp.IntegrationTests/Scenarios/Store/Models/LineItem.cs Adds a virtual [Expressive] property (suppressed EXP0038) to support EF Core regression coverage.
tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/InterfaceTests.cs Updates default interface member test to expect EXP0038 warning.
tests/ExpressiveSharp.Generator.Tests/ExpressiveGenerator/DiagnosticTests.cs Adds new tests asserting EXP0038 behavior for virtual/override vs non-virtual members.
tests/ExpressiveSharp.EntityFrameworkCore.IntegrationTests/Infrastructure/StoreQueryTestBase.cs Adds EF Core regression test ensuring virtual expressive member expands and translates to SQL.
src/ExpressiveSharp/Services/ExpressiveReplacer.cs Removes checks that previously skipped expansion for polymorphic members.
src/ExpressiveSharp.Generator/Infrastructure/Diagnostics.cs Introduces EXP0038 diagnostic descriptor.
src/ExpressiveSharp.Generator/ExpressiveGenerator.cs Emits EXP0038 when [Expressive] is applied to virtual/abstract/override members.
docs/reference/diagnostics.md Documents EXP0038 in the diagnostics reference.
docs/advanced/limitations.md Adds a detailed “Virtual and Polymorphic Members” limitations section with workarounds.
.devcontainer/devcontainer-lock.json Adds devcontainer feature lock file for reproducible devcontainer setup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -80,8 +77,7 @@ protected override Expression VisitMethodCall(MethodCallExpression node)

var methodInfo = node.Object?.Type.GetConcreteMethod(node.Method) ?? node.Method;
Comment thread src/ExpressiveSharp/Services/ExpressiveReplacer.cs
@koenbeuk koenbeuk merged commit a781ea0 into main Jun 1, 2026
17 checks passed
@koenbeuk koenbeuk deleted the feat/virtual-expressive-members branch June 1, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants