# `MutagenEx.Mutators.ElseRemoval`
[🔗](https://github.com/iautom8things/mutagen_ex/blob/v0.2.0/lib/mutagen_ex/mutators/else_removal.ex#L1)

Removes the `else` branch from an `if` or `with` expression.

Per `mutagen.mutators` catalog entry 9.

## AST shape

`if cond do A else B end` parses as

    {:if, meta, [cond, [do: A, else: B]]}

`with C1 <- E1, do: A, else: (pattern -> B)` parses as

    {:with, meta, [c1_clause, [do: A, else: [{:->, _, [[pattern], B]}]]]}

## Removal

We drop the `:else` key from the keyword list at the tail.

## Validation

* `:structurally_invalid` — `else` removal would leave a call site that
  pattern-matches the original `if`/`with` for both branches. The catalog
  cannot prove this from a single node in isolation; in v1 we mark
  removal `:ok` unconditionally and rely on the runner to surface a
  `:compile_error` outcome when the caller's pattern matching breaks.
  Scenario `mutagen.mutators.s6` documents the eventual goal of context-
  sensitive validation; the v1 behaviour is the conservative subset that
  still does the swap and lets the runtime be the judge.

The shape itself is validated: a non-`if`/non-`with` input is
`:structurally_invalid`, as is a form that has no `else` branch in the
first place (nothing to drop — the catalog should not have matched it).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
