Skip to content

Strange exception raises at eex with cond at the first line #5752

@asiniy

Description

@asiniy

Environment

  • Elixir & Erlang versions (elixir --version): 1.3.4 & 19.2
  • Operating system: ubuntu

Current behavior

I have an .eex partial for my phoenix application. It has an <%= cond do %> at the first line and raises unpredictable web/templates/layout/_header_user_menu.html.eex:1: expected -> clauses for do in cond:

** (CompileError) web/templates/layout/_header_user_menu.html.eex:1: expected -> clauses for do in cond
    (stdlib) lists.erl:1354: :lists.mapfoldl/3
    (stdlib) lists.erl:1354: :lists.mapfoldl/3
    (stdlib) lists.erl:1355: :lists.mapfoldl/3
    (stdlib) lists.erl:1354: :lists.mapfoldl/3
    (stdlib) lists.erl:1355: :lists.mapfoldl/3

My code is:

<%= cond do %>
<% is_nil(assigns[:current_user]) -> %>
  <!-- doens't matter -->
<% @current_user.state != "lack_of_credentials" -> %>
  <!-- doesn't matter -->
<% true -> %>
  <!-- nothing -->
<% end %>

Is it a bug or feature?

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