This was originally opened at codepelex by latkin
Repro in VS 2013. Reported by Tomas P via fsbugs.
The RequireQualifiedAccess attribute should force users to include the DU name when accessing a DU member. However as shown below, it incorrectly allows access using only the module name.
module First =
[<RequireQualifiedAccess>]
type DU = Member of int
module Second =
open First
let a = Member(0) // Error (as expected)
let b = DU.Member(0) // Ok (as expected)
let c = First.Member(0) // This works too! (unexpected!)
Per Don:
This is a bug – the code below should give an error. We need to fix this in F# vNext.
It is possible we will need to make it a “this has been deprecated, please adjust your code” warning instead to reduce the impact of the fix.