Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using true: or false: as map keys gives parser error: <end of expression> expected, got ',' #1105

Closed
Narnach opened this Issue May 7, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@Narnach
Copy link

commented May 7, 2018

It looks like the Elixir plugin (version 7.4.0) has a parsing problem when you use :true or :false as keys in a map when using the {true: "true"} notation. Using either true or :true explicitly when using the {true => "true"} notation is perfectly fine.

This example will demonstrate the parser failure when loaded in a scratch pad or file:

defmodule TrueFalseAsKeys do
  @perfectly_fine %{
    true => "true",
    false => "false"
  }
  @perfectly_fine_too %{
    :true => "true",
    :false => "false"
  }
  # The next line breaks with:
  #   <block identifier>, <end of expression>, EEx Empty Marker, '\\n, \\r\\n, or end expected, got '@'
  @broken_parser_but_working_code %{
    # Another error shows for the comma at the end of this line:
    #   <end of expression> expected, got ','
    true: "true",
    false: "false"
  }
end

When loaded in iex or as part of compiling a file, all three maps work fine. This leads me to believe it is simply an edge case that the Elixir plugin does not yet support, rather than a problem with the code.

@KronicDeth KronicDeth added this to the 7.5.0 milestone Jun 2, 2018

@KronicDeth KronicDeth self-assigned this Jun 2, 2018

KronicDeth added a commit that referenced this issue Jun 2, 2018

KronicDeth added a commit that referenced this issue Jun 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.