Fix AttributeUsage.AllowMultiple not inherited for C#-defined attributes#19315
Open
edgarfgp wants to merge 8 commits intodotnet:mainfrom
Open
Fix AttributeUsage.AllowMultiple not inherited for C#-defined attributes#19315edgarfgp wants to merge 8 commits intodotnet:mainfrom
edgarfgp wants to merge 8 commits intodotnet:mainfrom
Conversation
Contributor
❗ Release notes required
|
Contributor
Author
|
This is ready! |
T-Gro
reviewed
Mar 2, 2026
cd42e58 to
c08bf2d
Compare
T-Gro
approved these changes
Apr 1, 2026
Member
T-Gro
left a comment
There was a problem hiding this comment.
This is good now, thanks for the fix!
…tes (dotnet#17107) The F# compiler was not walking the inheritance chain for IL-imported (C#) attribute types when checking AllowMultiple. The supersOfTyconRef function only used tcaug_super, which is not populated for IL types. This fix parameterizes TryFindAttributeUsageAttribute with a getSuper resolver function. The caller in PostInferenceChecks now passes a resolver using GetSuperTypeOfType, which correctly handles both F# and IL-imported types via ILTypeDef.Extends.
# Conflicts: # docs/release-notes/.FSharp.Compiler.Service/10.0.300.md
…eAttribute Move hierarchy walking logic to PostInferenceChecks.fs where ImportMap is directly available via GetSuperTypeOfType. TryFindAttributeUsageAttribute now performs a single-tcref lookup; the recursive walk up the inheritance chain is handled at the call site in CheckAttribs.
a4bb978 to
7834a63
Compare
Contributor
Author
|
/azp run |
|
Commenter does not have sufficient privileges for PR 19315 in repo dotnet/fsharp |
Contributor
Author
|
@T-Gro this is ready!! |
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.
Description
The F# compiler was not walking the inheritance chain for IL-imported (C#) attribute types when checking AllowMultiple. The
supersOfTyconReffunction only usedtcaug_super, which is not populated for IL types.This fix parameterizes
TryFindAttributeUsageAttributewith a getSuper resolver function. The caller in PostInferenceChecks now passes a resolver using GetSuperTypeOfType, which correctly handles both F# and IL-imported types via ILTypeDef.Extends.Fixes #17107
Checklist