Skip to content

Report FS3888 for generic attribute type abbreviations instead of FS0193#19915

Open
T-Gro wants to merge 6 commits into
mainfrom
fix/issue-7877
Open

Report FS3888 for generic attribute type abbreviations instead of FS0193#19915
T-Gro wants to merge 6 commits into
mainfrom
fix/issue-7877

Conversation

@T-Gro

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

Copy link
Copy Markdown
Member

Fixes #7877

type MyAttr<'T>() = inherit System.Attribute()
type B = MyAttr<int>
[<B>] let x = 1
// before: internal compiler error FS0193
// after:  FS3888 "Generic attributes are not supported..."

Copilot and others added 3 commits June 9, 2026 09:45
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…7877)

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 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

❗ Release notes required

You can open this PR in browser to add release notes: open in github.dev


✅ 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 github-actions Bot added the AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed label Jun 9, 2026
@T-Gro T-Gro requested a review from abonie June 12, 2026 10:08
let tcref = tcrefOfAppTy g ty

if not tcref.TyparsNoRange.IsEmpty then
errorR(Error(FSComp.SR.tcGenericAttributesNotSupported(tcref.DisplayName), mAttr))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This calls errorR unconditionally, ignoring the canFail mode, seems like it might lead to duplicate diagnostics.

The test should perhaps assert more than just withErrorCode 3888 and check that there is only one error.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch, both addressed in 51056cd.

  • The error path now honors canFail: under IgnoreAllErrors/IgnoreMemberResoutionError it returns [], true (suppress + signal failure so the later report-all pass surfaces it once), and only emits errorR under ReportAllErrors — mirroring the existing constructor-resolution handling a few lines below. No more duplicate FS3888.
  • The repro test now uses withSingleDiagnostic asserting exactly one error with its full message and range.

Copilot AI and others added 2 commits June 25, 2026 11:03
…iagnostics

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve FSComp.txt error-number collision: renumber the generic-attribute
diagnostic tcGenericAttributesNotSupported from 3888 to 3890 (3888/3889 were
taken by origin/main). Update its tests and release note to FS3890. Adapt the
generic-attribute check to the removal of EntityRef.TyparsNoRange (now Typars).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Error using type abbreviation for attribute

3 participants