# RAN002 Generated union case tester in a Fable library

`warning RAN002`: *`policy.IsQueue` calls a compiler-generated union tester, which a Fable precompiled assembly does
not declare.*

**Cause.** F# generates an `IsCase` property for each union case. A precompile of the library by Fable 5.21 or earlier
that calls one fails with `MethodDefNotFound` for the getter, for public, internal and private unions alike. Fable 5.22
and Fickl 0.3.0 declare the testers, as does the pinned Fickl 0.5.3 (Fable 5.23). The rule runs in a project that Fable compiles (see
[Where the rules run](index.md#where-the-rules-run)) when its tool manifests declare `fable` before 5.22, a prerelease
of 5.22 included, or declare no compiler, and reports every tester of a union declared in the project, generic unions
included.

**Fix.** Match on the case. The rule's fix writes the `match`.

### Triggers

```fsharp
module Example

type Policy =
    | Queue
    | Drop of int

let queued (policy: Policy) = policy.IsQueue
```

### Fixed

```fsharp
module Example

type Policy =
    | Queue
    | Drop of int

let queued (policy: Policy) =
    match policy with
    | Queue -> true
    | _ -> false
```

**Suppression.** `// fsharpanalyzer: ignore-line RAN002`, with the reason on the line before.
