Compile this code:
open System
[<AttributeUsage(AttributeTargets.Method)>]
type MethodOnlyAttribute() =
inherit System.Attribute()
[<MethodOnly>]
let abc () =
"abc"
[<MethodOnly>]
let def =
"def"
Expected behavior
Compilation should fail because def is not a method; it is a string.
Actual behavior
The code compiles.
Known workarounds
Take care not to use attributes incorrectly.
Related information
#4460 is not quite the same, but a fix will probably touch the same code.
- Operating system: Linux
- .NET Runtime kind: .NET Core, Fable
- Editing Tools: Visual Studio Code
Compile this code:
Expected behavior
Compilation should fail because
defis not a method; it is astring.Actual behavior
The code compiles.
Known workarounds
Take care not to use attributes incorrectly.
Related information
#4460 is not quite the same, but a fix will probably touch the same code.