Conversation
|
Thank you. |
There was a problem hiding this comment.
Pull request overview
This PR updates the source generator to consistently gate use of the C# 11 scoped modifier on both the target framework and language version, preventing mismatches with base formatter signatures as described in issue #378.
Changes:
- Update all generator
scopedRefdecisions to require bothcontext.IsNet7OrGreaterandcontext.IsCSharp11OrGreater(), ensuringscoped refis only emitted when compatible with the runtime and language. - Simplify the
fixedSizedetection logic by replacing a manual loop-and-flag pattern with a singleMembers.All(...)boolean expression.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var fixedSizeInterface = ""; | ||
| var fixedSizeMethod = ""; | ||
| scopedRef = (context.IsCSharp11OrGreater()) | ||
| scopedRef = context.IsNet7OrGreater && context.IsCSharp11OrGreater() |
There was a problem hiding this comment.
The new scopedRef condition (context.IsNet7OrGreater && context.IsCSharp11OrGreater()) fixes the reported mismatch between generated scoped parameters and the base formatter signatures, but there doesn't appear to be a regression test that covers this specific matrix (C# 11 language version with IsNet7OrGreater == false). It would be helpful to add a generator test that simulates this environment and asserts that the generated formatter methods use plain ref, so future changes to IsNet7OrGreater/language-version logic don't reintroduce this compiler error.
issue description: #378