Skip to content

feat: C# 14 extension members with versioned Roslyn analyzers - #57

Merged
ycherkes merged 10 commits into
dev_v0_8_0from
feat/extension-members-parity-v0.8.0
Nov 3, 2026
Merged

ycherkes merged 10 commits into
dev_v0_8_0from
feat/extension-members-parity-v0.8.0

Conversation

@ycherkes

@ycherkes ycherkes commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

C#14 instance extension methods and expression properties now generate static expression factories and inline transitively. The package ships separate Roslyn4.8 and Roslyn5.0 analyzer assets, preserving older compiler-host support.

MERGE ONLY AFTER OWNER APPROVAL. Target: dev_v0_8_0; keep this PR open/unmerged. No auto-merge, release, tag or NuGet publication.

Generated API:

OrderExtensions.AmountWithTaxExpression(); // Expression<Func<Order, decimal>>
OrderExtensions.LabelExpression(100);     // Expression<Func<Order, string>>

Compiler compatibility:

  • Roslyn4.8 through4.x selects analyzers/dotnet/roslyn4.8/cs/AlephMapper.dll for classic projections/helpers/switches/Update/Adapt.
  • Roslyn5.0+ selects analyzers/dotnet/roslyn5.0/cs/AlephMapper.dll and adds CSharp14 extension members.
  • Both netstandard2.0 variants share the implementation, assembly identity/version and resources. New syntax/symbol APIs are isolated behind compile-time compatibility helpers; no reflection or text-based syntax detection.
  • No compiler DLLs or unversioned duplicate analyzer are packed. SDK selects exactly one compatible asset; hosts below4.8 remain unsupported.
  • Actual old5.0-only package failure reproduced as CS9057 under compiler4.14. A net8 target under SDK10 alone had not tested older-host compatibility.

Validation:

  • Full existing suite: 191 passed, 0 failed, 0 skipped.
  • Release and Debug build; clean Release build followed by pack --no-build --no-restore.
  • Package ZIP contains exactly the two intended analyzer assemblies.
  • Real isolated csc4.8.0,4.14.0,5.0.0 and SDK10.0.403/Roslyn5.9 pass analyzer selection and runtime tests. Compiler version, wrapper invocation and single selected analyzer band are checked. Tests execute classic projection, switch/type/property/list patterns, helpers, Update/Adapt and AM0019 retention; modern hosts also execute CSharp14 factories/composition. Load warnings are errors. Existing nullable warnings remain visible.
  • CI now installs net8 and10 and runs the same package matrix. scripts/verify_roslyn_compatibility.py documents why an old Toolset PackageReference alone is insufficient under SDK10.
  • Local compatibility review identified a missing legacy project solution entry; fixed and verified clean Release/no-build packing. Earlier extension-member review findings were fixed with targeted regressions.

Extension scope: primitive/interface/struct/nullable/reference receivers, named arguments and overloads, classic/CSharp14 composition, nested LINQ and switches, null strategies, symbol-safe lambda/anonymous-member binding, deterministic partial discovery.

AM0021 exclusions: generic extension blocks/methods, static extension members, block/accessor bodies, query syntax, bound extension method groups, optional/params/ref arguments, ref-like receivers/ref returns, factory signature conflicts and inaccessible expanded dependencies. Direct Updatable/Adapt extension requests are diagnosed. Existing classic Update/Adapt remain supported; no AM0020 or purity gate was restored. SQL translation remains provider dependent; SQLite scalar DTO projection is tested.

Baseline: #56 squash-merged on 2026-11-03 into dev_v0_8_0 at d154572. main remains3fcc1a76b1bec0f4f6eacda49add93c8879e0350.

Multiversion plan/evidence | extension matrix | execution log | unpublished release draft.

The extension-members PR has NOT been merged. Awaiting owner approval to merge into dev_v0_8_0.

Final compatibility verification: HEAD811f9d0f2c1182a5bdff845bfda350d62bcba6da. CI on Linux passed, including the new real-compiler matrix and no-build packaging: https://github.com/Raffinert/AlephMapper/actions/runs/41699486158 . Local Windows matrix also passed. Full191 tests pass. Codex compatibility review completed on this exact HEAD with no findings and no unresolved findings. Worktree clean; main/integration unchanged; PR remains OPEN and unmerged.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T19:05:34.164739Z 811f9d0 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

ycherkes commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

Please review the latest feature head for correctness, symbol capture, receiver conversions, generated API collisions and Roslyn host compatibility. The documented AM0021 exclusions are intentional. MERGE ONLY AFTER OWNER APPROVAL; this PR must remain open targeting dev_v0_8_0.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 713c68d1f5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

ycherkes commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Validation update for HEAD 713c68d: GitHub CI is green, including restore, Release build, tests, NuGet pack and package-consumer smoke. Run: https://github.com/Raffinert/AlephMapper/actions/runs/41689329495 . Local full suite: 186 passed, 0 failed/skipped; Debug build and fresh CSharp14/net10 plus classic CSharp12/net8 packaged consumer execution also passed. Existing nullable warnings remain visible.

Independent local review findings were fixed across three bounded cycles. Remote Codex review is still running. main remains 3fcc1a7, integration remains d154572. PR must remain OPEN and unmerged pending explicit owner approval.

ycherkes commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

Both P2 findings from the first remote review are fixed in a11b372 with targeted regressions; all189 tests and package consumers pass. Please review the corrected head. This is remote review cycle2/3. Do not merge; owner approval is required.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a11b37295e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

ycherkes commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

Final bounded remote review cycle3/3 for HEAD9aac79a. Addressed inferred anonymous member naming; preserved root nameof constants and recorded that nameof(extensionProperty) is itself CSharp14-invalid (CS9316). Both previous threads answered/resolved. Full191 tests, Release/Debug builds, pack and fresh net10/net8 consumers pass. Do not merge; owner approval is required.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 9aac79a475

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ycherkes ycherkes changed the title feat: C# 14 extension methods and properties parity for v0.8.0 feat: C# 14 extension members with versioned Roslyn analyzers Nov 3, 2026

ycherkes commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

Owner-requested compatibility follow-up in5090695/811f9d0: one NuGet now ships shared-source Roslyn4.8 and5.0 analyzer bands. Actual csc4.8/4.14/5.0 plus SDK5.9 package-selection/runtime checks and full191 tests pass. Please focus this review on the new multiversion packaging/shim/CI changes since9aac79a. Clean Release build plus pack --no-build is covered. This PR must remain unmerged pending owner approval.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 811f9d0f2c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ycherkes
ycherkes merged commit 2bb1789 into dev_v0_8_0 Nov 3, 2026
1 check passed
ycherkes added a commit that referenced this pull request Nov 3, 2026
* fix: preserve switch and inlining semantics in generated expressions (#56)

* fix: lower switch type and relational patterns without changing semantics

* fix: preserve method symbols during inlining and report unsupported rewrites

* test: cover switch semantics, symbol substitution and safe inlining

* test: use observably side-effectful argument in AM0020 regression

* fix: initialize shared nested diagnostic collections once

* docs: align usage samples with generated APIs

* docs: align usage samples with generated APIs

* fix: do not classify null-forgiving operator as a side effect

* fix: avoid redundant parentheses for already-grouped arguments

* test: align switch-safe inlining golden output formatting

* fix: address method-group receiver substitution and update-only switch review

* fix: preserve binding in conditional indexers and switch pattern locals

* fix: avoid redeclaring pattern designation local

* test: keep Ignore indexed access case separate from nullable coalescing

* test: make Ignore-mode non-null precondition explicit

* fix: group lower-precedence switch governing expressions after helper inlining

* test: prevent switch helper inlining from changing && comparison precedence

* fix: preserve switch guard precedence after helper inlining

* fix: visit LINQ method-group receiver outside callee call stack

* fix: reject effectful switch inputs duplicated by expression lowering

* test: repeated method-group helper in LINQ chain is not circular

* test: detect repeated switch inputs without rejecting single evaluation

* fix: bind declaration pattern locals within nested pattern wrappers

* test: nested parenthesized pattern local resolves without capturing caller name

* fix: preserve helper-body precedence at direct-call inline site

* test: direct inline and switch arm preserve arithmetic precedence

* fix: preserve inlining precedence without unnecessary grouping in snapshots

* fix: allow repeated switch input evaluation like ExpressiveSharp

* test: allow repeated governing calls and ToLower switch expression

* fix: parenthesize cast operands and right-associative coalescing inliners

* fix: preserve helper declared return conversions when inlining

* fix: guard relational narrowing and correct NaN/null pattern semantics

* fix: retain safe-repeatability for synthesized null-conditional ternaries

* fix: make AM0020 path-sensitive and detect reordered effectful arguments

* test: cast, coalescing, numeric conversion, null-pattern and nullable inlining regressions

* test: relational/NaN diagnostics and AM0020 path and argument-order safety

* docs: explain ExpressiveSharp-compatible switch input re-evaluation policy

* docs: align AM0020 message with reordered or omitted argument protections

* refactor: remove AM0020 evaluation guard from helper inlining

* refactor: drop AM0020 blocking from projection generation

* refactor: remove AM0020 checks from update generation

* refactor: remove AM0020 checks from adaptation generation

* refactor: remove obsolete AM0020 diagnostic descriptor

* test: verify unguarded effectful helper inlining

* docs: explain unguarded helper argument substitution policy

* docs: remove obsolete AM0020 reference from README

* refactor: carry symbol bindings in switch pattern lowering results

* feat: lower type var and recursive property switch patterns

* feat: lower verified array and list patterns with noncapturing slices

* feat: verify record components and preserve nested switch conversions

* fix: preserve pattern narrowing and helper parameter conversions

* fix: group converted lambda arguments during helper inlining

* docs: record switch parity coverage and final verification

* update packages, reference System.Security.Cryptography.Pkcs" Version="10.0.14 directly until Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing fixed to refer good version of Pkcs

* style: remove extra blank lines in semantic regression tests

* feat: C# 14 extension members with versioned Roslyn analyzers (#57)

Add source-generated C# 14 extension methods/properties and symbol-aware composition. Ship shared-source Roslyn 4.8 and 5.0 analyzer bands with automatic compatible selection.

Validated: 191 tests; actual compiler 4.8/4.14/5.0/5.9 package matrix on Windows and Linux; Release/Debug builds; clean no-build packing; final Codex review without findings.

Squash merge into dev_v0_8_0 explicitly approved by owner.

* fix: centralize mapper validation and symbol-based member reservations

* refactor: share inlining context, binding and reference handling

* fix: handle unnamed tuple signatures and document switch comparison

* chore: bump AlephMapper to 0.8.0

* docs: credit ExpressiveSharp inspiration

* fix: preserve expressions when nullable visitor returns null
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.

1 participant