-
Notifications
You must be signed in to change notification settings - Fork 832
Open
Open
Copy link
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
Description
Seems related to #9256.
C# attribute definitions:
[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
public class BaseAttribute : Attribute;
public class ChildAttribute : BaseAttribute;This works fine in C#, i.e., the following compiles:
[Child]
[Child]
public class Foo;However, the following F# code does not:
[<Child>]
[<Child>]
type Foo() = class endThis fails on the second [<Child>] line with FS0429:
Error FS0429 : The attribute type 'ChildAttribute' has 'AllowMultiple=false'. Multiple instances of this attribute cannot be attached to a single language element.
If ChildAttribute is defined in F# instead, it works.
A simple, but of course suboptimal workaround is to subclass the desired (already subclassed) attribute and set the correct AttributeUsage on it.
Metadata
Metadata
Assignees
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Type
Projects
Status
New