-
Notifications
You must be signed in to change notification settings - Fork 833
Closed
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBreaking-changeDescribes a bug which is also a breaking change.Describes a bug which is also a breaking change.Bug
Milestone
Description
Please provide a succinct description of the issue.
Repro steps
open System
[<AttributeUsage(AttributeTargets.Struct)>]
type CustomStructAttribute() =
inherit Attribute()
[<AttributeUsage(AttributeTargets.Class)>]
type CustomClassAttribute() =
inherit Attribute()
[<CustomStruct>]
[<CustomClass>]
type Color =
| Red = 0
| Green = 1
| Blue = 2enum compiles down to sharplab
[CompilationMapping(SourceConstructFlags.Module)]
public static class @_
{
[Serializable]
[AttributeUsage(AttributeTargets.Struct)]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public class CustomStructAttribute : Attribute
{
}
[Serializable]
[AttributeUsage(AttributeTargets.Class)]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public class CustomClassAttribute : Attribute
{
}
[Serializable]
[CustomStruct]
[CustomClass]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public enum Color
{
Red,
Green,
Blue
}
}Expected behavior
Should not compile and Error 842 "This attribute is not valid for use on this language element" should be reported.
Actual behavior
Compiles
Known workarounds
Provide a description of any known workarounds.
Related information
Provide any related information (optional):
- Operating system
- .NET Runtime kind (.NET Core, .NET Framework, Mono)
- Editing Tools (e.g. Visual Studio Version, Visual Studio)
Metadata
Metadata
Assignees
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBreaking-changeDescribes a bug which is also a breaking change.Describes a bug which is also a breaking change.Bug
Type
Projects
Status
Done