Mutare.Mutators.AtomLiteral (mutare v0.1.1)

Copy Markdown View Source

Replaces a literal atom with :mutare. The replacement is omitted when the original atom is already :mutare.

The following atoms are excluded:

Ordinary atom values, data map and keyword keys, and atoms in case, receive, and fn patterns remain eligible. Keys in a trailing call-options list are also mutated by default. Configure {Mutare.Mutators.AtomLiteral, call_option_keys: false} to exclude those keys.

:infinity in a known timeout/duration position (e.g. the Task.await/2 or GenServer.stop/3 timeout) is left unmutated. This family reuses Mutare.Mutators.IntegerLiteral's timeout table (via Mutare.Mutator.argument_marks/1) so the two value families agree on which positions hold an opaque timeout literal, and declines when the :timeout mark is present. A non-duration sibling atom in the same call still mutates: GenServer.stop(s, :normal, :infinity) mutates the :normal reason but not the :infinity timeout.

Project-specific timeout positions come from the argument_marks: option (declared with the :timeout label, as documented on Mutare.Mutators.IntegerLiteral); :infinity at such a position is left alone the same way. To keep an atom position out of every family whatever its value — a mode or an action name — route it :raw in call_routes: (see Mutare.CallRouting).

Interpolated quoted atoms (:"a#{x}b") are mutated as a whole to the sentinel — their runtime value can never statically be :mutare, so the swap always applies — while the expressions inside the interpolation stay eligible for their own mutations, mirroring how Mutare.Mutators.StringLiteral treats interpolated strings.