Header menu logo G-Research F# Analyzers

UnionCaseAnalyzer

Problem

A discriminated union case with the same name as a case from FSharp.Core is considered harmful. It may shadow the case from FSharp.Core and it is to be avoided.

type MyU =
    | Case1
    | None
    | Case3

Fix

Add [<RequireQualifiedAccess>] on the type:

[<RequireQualifiedAccess>]
type MyU =
    | Case1
    | None
    | Case3

If you use the Ionide integration, there's a quick fix available:

UnionCaseShadow

type MyU = | Case1 | None | Case3
union case Option.None: Option<'T>
Multiple items
type RequireQualifiedAccessAttribute = inherit Attribute new: unit -> RequireQualifiedAccessAttribute

--------------------
new: unit -> RequireQualifiedAccessAttribute

Type something to start searching.