fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

AttributeTargets better error message

Open edgarfgp opened this issue 5 months ago • 1 comments

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

  • [x] Test cases added
  • [x] Release notes entry updated

edgarfgp avatar May 30 '25 17:05 edgarfgp