View Source Matcha.Rewrite.Kernel (Matcha v0.1.10)

Replacements for Kernel functions when rewriting Elixir into match specs.

These are versions that play nicer with Erlang's match spec limitations.

Link to this section Summary

Link to this section Functions

Link to this macro

left and right

View Source (macro)

Re-implements Kernel.and/2.

This ensures that Elixir 1.6.0+'s boolean optimizations don't create (disallowed) case statements inside match spec bodies.

Link to this macro

is_boolean(value)

View Source (macro)

Re-implements Kernel.is_boolean/1.

The original simply calls out to :erlang.is_boolean/1, which is not allowed in match specs (as of Erlang/OTP 25). Instead, we re-implement it in terms of things that are.

See: https://github.com/erlang/otp/issues/7045

Link to this macro

is_exception(term)

View Source (macro)

Re-implements Kernel.is_exception/1.

This borrows the guard-specific implementation from Elixir since what Elixir wants to do in normal bodies is invalid in match specs.

Link to this macro

is_exception(term, name)

View Source (macro)

Re-implements Kernel.is_exception/2.

This borrows the guard-specific implementation from Elixir since what Elixir wants to do in normal bodies is invalid in match specs.

Link to this macro

is_struct(term)

View Source (macro)

Re-implements Kernel.is_struct/1.

This borrows the guard-specific implementation from Elixir since what Elixir wants to do in normal bodies is invalid in match specs.

Link to this macro

is_struct(term, name)

View Source (macro)

Re-implements Kernel.is_struct/2.

This borrows the guard-specific implementation from Elixir since what Elixir wants to do in normal bodies is invalid in match specs.

Re-implements Kernel.or/2.

This ensures that Elixir 1.6.0+'s boolean optimizations don't create (disallowed) case statements inside match spec bodies.