Attempting to fix #17904 and #19020#19738
Draft
edgarfgp wants to merge 6 commits into
Draft
Conversation
In mkSynBinding, move any attribute written with the explicit 'return:' target from the binding's prefix attributes into SynValData.SynValInfo.retInfo. This makes the syntactic placement (which the parser puts on the binding) match the semantic intent (the attribute targets the method's return value). Fixes: - dotnet#19020: [<return: X>] silently dropped on class members - dotnet#17904: false-positive AllowMultiple=false when [<X>] and [<return: X>] appear on the same member
Contributor
❗ Release notes required
|
Contributor
|
🔍 Tooling Safety Check — Affects-Compiler-Output (scanned-sha)d0bf14fb399fd3bc266dfe8f2aa7e88c6d1775ff(/scanned-sha)
|
…-pattern detection After SynInfo.RotateReturnAttributes moves [<return: X>] from the binding's prefix attributes into SynValData.SynValInfo.retInfo, two downstream consumers also need updating: - TcNormalizedBinding's retAttribs computation now type-checks attrs already in valSynData's return SynArgInfo, so isStructRetTy/argAndRetAttribs work for [<return: Struct>] on partial active patterns. - ActivePatternElemsOfValRef now classifies the flag bag from ValReprInfo's result ArgReprInfo rather than scanning vref.Attribs. Fixes recursive struct active patterns (e.g. let rec (|HasOne|_|)).
With the parser-level rotation in SynInfo.RotateReturnAttributes, the binding's prefix attrs never contain [<return: X>] by the time TcNormalizedBinding runs. The partition-and-rotate dance and the valSynData patch are no-ops in every reachable case, so remove them and read return attrs directly from SynValData.SynValInfo.retInfo (where the parser put them) plus any attrs on the return type annotation.
Contributor
Author
|
@T-Gro I think the CI is stuck or it has not even started. |
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.
Attempting to fix #17904 and #19020.