Skip to content

Extend constructor/member association to leading acronyms - #556

Closed
eiriktsarpalis wants to merge 1 commit into
mainfrom
eiriktsarpalis-issue-555-triage
Closed

eiriktsarpalis wants to merge 1 commit into
mainfrom
eiriktsarpalis-issue-555-triage

Conversation

@eiriktsarpalis

Copy link
Copy Markdown
Owner

Summary

Explore acronym-aware constructor/member association using the shared CamelCaseInvariantComparer, so reflection and source generation recognize ilDelta as corresponding to ILDelta.

  • Normalize leading acronym letters without allocating a normalized string, and hash the same normalized characters for constructor-selection dictionaries.
  • Preserve existing first-letter matches such as iLDelta/ILDelta; also support url/URL, urlValue/URLValue, and acronyms before digits.
  • Keep the remaining name case-sensitive: ildelta/ILDelta and myUrl/MyURL remain distinct. Non-letter prefixes such as _ do not enable acronym matching.
  • Document the association rule and add shared type scenarios plus public-API regressions covering constructor invocation, fields and init properties, overload selection, logical-name overrides, and ambiguous CLR names.

Compatibility considerations

This is an intentional behavioral change, not a compatibility-neutral patch. Newly associated members can change constructor selection, parameter logical names and property-derived requiredness, and which member initializers remain in the constructor shape. Keeping this PR in draft makes that policy change explicit for review.

No new ambiguity policy is introduced: the first matching member supplies property-derived naming and requiredness, without preferring exact spelling. Existing provider-specific initializer-deduplication algorithms are unchanged. Existing first-letter equivalences are preserved.

Validation

make test passed on macOS ARM64, including the complete CLR suite with coverage (297,313 passed, 68 skipped) and all 46 Native AOT smoke tests. The new positive association regressions failed against the original comparer before the implementation change.

No MessagePack dependency or integration test is added; this draft exercises the PolyType constructor-shape behavior directly through public APIs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.47%. Comparing base (8f1116a) to head (c6c58ef).

Files with missing lines Patch % Lines
src/Shared/Helpers/CommonHelpers.cs 95.83% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #556   +/-   ##
=======================================
  Coverage   94.47%   94.47%           
=======================================
  Files         299      299           
  Lines       19637    19650   +13     
  Branches     3836     3842    +6     
=======================================
+ Hits        18552    18565   +13     
  Misses        796      796           
  Partials      289      289           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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