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 = 2
enum 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)
Please provide a succinct description of the issue.
Repro steps
enumcompiles down to sharplabExpected 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):