Skip to content

Conversation

@edgarfgp
Copy link
Contributor

@edgarfgp edgarfgp commented Mar 8, 2024

Description

Fixes #16794

Before

open System

[<AttributeUsage(AttributeTargets.Method)>]
type CustomMethodAttribute() =
    inherit Attribute()
    
type Class1 [<CustomMethod>] (x) = class end
[Serializable]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public class Class1
 {
     [CustomMethod]
     public Class1(object x)
     {
     }
 }

After

Error 842, "This attribute is not valid for use on this language element")

Checklist

  • Test cases added

  • Release notes entry updated:

    Please make sure to add an entry with short succinct description of the change as well as link to this pull request to the respective release notes file, if applicable.

    Release notes files:

    • If anything under src/Compiler has been changed, please make sure to make an entry in docs/release-notes/.FSharp.Compiler.Service/<version>.md, where <version> is usually "highest" one, e.g. 42.8.200
    • If language feature was added (i.e. LanguageFeatures.fsi was changed), please add it to docs/releae-notes/.Language/preview.md
    • If a change to FSharp.Core was made, please make sure to edit docs/release-notes/.FSharp.Core/<version>.md where version is "highest" one, e.g. 8.0.200.

    Information about the release notes entries format can be found in the documentation.
    Example:

    If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request.

@edgarfgp edgarfgp requested a review from a team as a code owner March 8, 2024 20:47
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2024

❗ 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/8.0.300.md
LanguageFeatures.fsi docs/release-notes/.Language/preview.md

@edgarfgp
Copy link
Contributor Author

edgarfgp commented Mar 8, 2024

This should be merged after #16790

Copy link
Contributor

@psfinaki psfinaki left a comment

Choose a reason for hiding this comment

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

Thanks, good stuff again!

@edgarfgp
Copy link
Contributor Author

Will fix the conflicts tomorrow :)

@psfinaki
Copy link
Contributor

Sure, thanks :)

@edgarfgp
Copy link
Contributor Author

@psfinaki Based on your previous suggestion. I merged all the EnforceAttributeTargets LanguageFeatures into one.

@edgarfgp
Copy link
Contributor Author

This is ready

@psfinaki
Copy link
Contributor

Awesome, thanks :)

@psfinaki psfinaki enabled auto-merge (squash) March 14, 2024 13:03
@edgarfgp
Copy link
Contributor Author

I have 2-3 more PR planned in the upcoming weeks

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.

AttributeTargets.Method can be targeted in a constructor incorrectly

3 participants