Skip to content

AttributeTargets better error message #18641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Jul 10, 2025

Conversation

edgarfgp
Copy link
Contributor

@edgarfgp edgarfgp commented May 30, 2025

Description

BEFORE

We had one message to fit all the invalid attribute targets messages.

This attribute is not valid for use on this language element

AFTER

We have now: This attribute cannot be applied to (<one or more targets>). Valid targets are: (<one or more targets>) e.g.

  • This attribute cannot be applied to struct. Valid targets are: class
  • This attribute cannot be applied to property, field, return value. Valid targets are: method
  • This attribute cannot be applied to class. Valid targets are: interface
  • This attribute cannot be applied to method, property. Valid targets are: field

For cases here F# does not support attributes or still not a valid analysis for attribute targets that we want to enforce. We will still fallback to This attribute is not valid for use on this language element.

Checklist

  • Test cases added
  • Release notes entry updated

Copy link
Contributor

github-actions bot commented May 30, 2025

❗ 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/10.0.100.md

@edgarfgp edgarfgp force-pushed the attr-targets-better-error-message branch 2 times, most recently from 65634b0 to 39b5f4d Compare May 30, 2025 18:13
@edgarfgp edgarfgp force-pushed the attr-targets-better-error-message branch from 39b5f4d to 049472b Compare May 30, 2025 22:01
@edgarfgp edgarfgp force-pushed the attr-targets-better-error-message branch from 75543b9 to 0c55b19 Compare May 31, 2025 20:29
@edgarfgp edgarfgp marked this pull request as ready for review June 1, 2025 18:41
@edgarfgp edgarfgp requested a review from a team as a code owner June 1, 2025 18:41
@edgarfgp edgarfgp requested a review from T-Gro June 6, 2025 12:48
@github-project-automation github-project-automation bot moved this from New to In Progress in F# Compiler and Tooling Jun 19, 2025
@T-Gro T-Gro enabled auto-merge (squash) June 19, 2025 12:33
auto-merge was automatically disabled June 19, 2025 20:06

Head branch was pushed to by a user without write access

@edgarfgp edgarfgp force-pushed the attr-targets-better-error-message branch from b913943 to 0910017 Compare July 9, 2025 23:53
@edgarfgp edgarfgp force-pushed the attr-targets-better-error-message branch from 0910017 to 573461c Compare July 10, 2025 00:53
@T-Gro
Copy link
Member

T-Gro commented Jul 10, 2025

Hi @edgarfgp , this must have slipped trough! (I have enabled auto merge and stopped monitoring it here, but it got disabled due to a push).

Merging in now, this is definitely a good improvement for F# 10 👍

@T-Gro T-Gro merged commit e84544a into dotnet:main Jul 10, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants