Add [OverloadResolution] to methods to resolve new() ambiguity - #248
Merged
Conversation
…lyfill Instead of conditionally emitting the [OverloadResolutionPriority(1)] attribute based on a C# version check, always emit it gated behind preprocessor symbols: #if NET9_0_OR_GREATER || NETESCAPADES_ENUMGENERATORS_OVERLOAD_PRIORITY This simplifies the generator by removing the useOverloadPriority flag and removes the generated polyfill attribute — users who define NETESCAPADES_ENUMGENERATORS_OVERLOAD_PRIORITY must provide their own polyfill. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…gration tests The overload priority tests only work on .NET 9+ where OverloadResolutionPriorityAttribute exists in the BCL. On older TFMs, the preprocessor symbol is not defined, so the #if-gated attribute and associated tests are skipped. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ymbol Document how to resolve CS0121 overload ambiguity when using target-typed new() with generated Parse/TryParse/ToStringFast option overloads. On .NET 9+ this works automatically; on older TFMs users can define the preprocessor symbol and provide a polyfill (e.g. via SimonCropp/Polyfill). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Define NETESCAPADES_ENUMGENERATORS_OVERLOAD_PRIORITY and add a conditional polyfill of OverloadResolutionPriorityAttribute (gated with #if !NET9_0_OR_GREATER) to all integration test projects, including the netstandard2.0 library projects where the generator emits code. The overload priority tests are unguarded and run on all TFMs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.