Skip to content

The 'else' clause in 'with' does not support guards #4957

@alco

Description

@alco

Trying to compile the following piece of code on Elixir v1.3.1

with :ok <- {:error, :foo} do 
  :ok 
else 
  {:error, reason} when reason in [:foo, :bar] -> 
    :some_error 
  {:error, _} ->
    :generic_error
end

results in this error

** (CompileError) iex:1: cannot invoke local when/2 inside match, called as: {:error, reason} when :erlang.or(:erlang.=:=(reason, :bar), :erlang.=:=(reason, :foo))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions