Skip to content

Attempting to fix #17904 and #19020#19738

Draft
edgarfgp wants to merge 6 commits into
dotnet:mainfrom
edgarfgp:fix-17904-allowmultiple-attribute-targets
Draft

Attempting to fix #17904 and #19020#19738
edgarfgp wants to merge 6 commits into
dotnet:mainfrom
edgarfgp:fix-17904-allowmultiple-attribute-targets

Conversation

@edgarfgp
Copy link
Copy Markdown
Contributor

Attempting to fix #17904 and #19020.

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
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/11.0.100.md

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Tooling Safety Check — Affects-Compiler-Output
Affects-Compiler-Output: src/Compiler/SyntaxTree/SyntaxTreeOps.fs — changes attribute placement on compiled return values

(scanned-sha)d0bf14fb399fd3bc266dfe8f2aa7e88c6d1775ff(/scanned-sha)

Generated by PR Tooling Safety Check · ● 2.1M ·

@github-actions github-actions Bot added the ⚠️ Affects-Compiler-Output Tooling check: PR touches IL emission or codegen label May 15, 2026
edgarfgp added 5 commits May 15, 2026 08:15
…-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.
@edgarfgp
Copy link
Copy Markdown
Contributor Author

@T-Gro I think the CI is stuck or it has not even started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ Affects-Compiler-Output Tooling check: PR touches IL emission or codegen

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

F# compiler doesn't respect different attribute targets when checking for Multiple appliance

1 participant