Skip to content

[<RequireQualifiedAccess>] allows access to DU member if qualified only by module name #95

@KevinRansom

Description

@KevinRansom

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions