meyercm / shorter_maps

Elixir ~M sigil for map shorthand. `~M{id, name} ~> %{id: id, name: name}`
MIT License
233 stars 11 forks source link

Error parsing in mixed mode #6

Closed meyercm closed 7 years ago

meyercm commented 7 years ago

This code causes the macro to fail:

iex> import ShorterMaps
...> a= 5
...> ~M{key: [1, a, 2]} # expect %{key: [1, 5, 2]}
** (SyntaxError) lib/shorter_maps.ex:82: syntax error before: 2
    (shorter_maps) lib/shorter_maps.ex:82: ShorterMaps.do_sigil_m/2
    (shorter_maps) expanding macro: ShorterMaps.sigil_M/2

Anytime a mixed-mode value has > 3 comma-separated elements, where one of the middle elements is a variable or 0-arity function call, this will fail. For now, the workaround is to avoid those usages. A fix has been identified, should be available within the next few days.

meyercm commented 7 years ago

closed with v2.2.1