Skip to content

Enforce compiler-semantic attributes in signature conformance (issue #19560)#19880

Open
T-Gro wants to merge 7 commits into
mainfrom
fix/issue-19560
Open

Enforce compiler-semantic attributes in signature conformance (issue #19560)#19880
T-Gro wants to merge 7 commits into
mainfrom
fix/issue-19560

Conversation

@T-Gro
Copy link
Copy Markdown
Member

@T-Gro T-Gro commented Jun 2, 2026

Summary

Fixes #19560.

When an implementation file declares a compiler-semantic attribute (such as []) on a value or member, tooling does not consult the implementation when a corresponding .fsi signature file is present. This means attributes only on the impl are silently lost, changing the contract observed by consumers (inlining behaviour, dynamic dispatch, codegen).

This PR adds a signature conformance check that enforces these attributes must also appear in the signature, producing a clear error when they are missing.

Changes

  • src/Compiler/Checking/SignatureConformance.fs – Added signatureEnforcedAttributes list and a loop in CheckOneImplVal that errors if the impl value has an enforced attribute but the signature does not.
  • src/Compiler/FSComp.txt – New diagnostic message for the missing-attribute error.
  • src/FSharp.Core/prim-types.fsi / src/FSharp.Core/nativeptr.fsi – Added missing [] declarations to the signature files to satisfy the new check.
  • tests/FSharp.Compiler.ComponentTests/Conformance/Signatures/SignatureEnforcedAttributes.fs – New test file with 6 test cases covering the enforcement behavior.
  • docs/release-notes/.FSharp.Compiler.Service/11.0.100.md – Release note entry.
  • xlf files – Updated localization resource files with the new diagnostic string.

Testing

  • 6 new component tests validate both positive (error raised) and negative (no spurious errors) scenarios.
  • Existing signature conformance tests continue to pass.

Copilot and others added 4 commits June 2, 2026 14:46
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…(issue #19560)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>


Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

❗ Release notes required


✅ Found changes and release notes in following paths:

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

Copy link
Copy Markdown
Member

@auduchinok auduchinok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copilot and others added 2 commits June 2, 2026 18:30
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Attributes from implementation file are not seen by the compiler

2 participants