According to F# 4.1 spec, 13.1 Custom Attributes, the following attribute placement is possible
let foo a: [<SomeAttribute>] = a + 5
but it cannot be parsed with neither F# 4.1 nor F# 4.5 FCS/fsi. Specifying binding return type explicitly makes it parseable.
let foo: [<Attr>] = 12
let foo: [<Attr>] = 12
------------------^
stdin(3,19): error FS0010: Unexpected symbol '=' in binding
let foo: [<Attr>] int = 12
val foo : int = 12
This also compile
f#
let foo a: [<SomeAttribute>] _ = a + 5
Yes this is by design, the spec needs clarification
Most helpful comment
This also compile
f# let foo a: [<SomeAttribute>] _ = a + 5