meyercm / shorter_maps

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

Using ShorterMaps seems to mess with line numbers on errors #7

Closed hanrelan closed 7 years ago

hanrelan commented 7 years ago

When I use the ~M sigil, I find that the line numbers I see on errors thrown from Elixir are way off (eg. line 83 instead of line 3).

Is there a way to solve this issue? I'm on Elixir 1.5.1 and Erlang/OTP 20

meyercm commented 7 years ago

Can you give me a bit more to help reproduce the error?

Minimally, copy and paste over your stacktrace, and if you can provide a gist or a project for me to clone that demonstrates the issue succinctly, that would be really helpful.

hanrelan commented 7 years ago

Created a minimal repo for reproduction here: https://github.com/hanrelan/shorter_maps_repro

When I clone this repo and run mix I get the following:

warning: variable "something" is unused
  lib/shorter_maps_repro.ex:82

Removing the ~M sigil and changing it to %{something: something} instead changes the warning to:

warning: variable "something" is unused
  lib/shorter_maps_repro.ex:4
meyercm commented 7 years ago

Ok, I've found the problem and pushed a fix in v2.2.2 to hex. Give it a whirl and make sure that it fixes the problem in your production code.

Thanks for taking the time to file an issue!

hanrelan commented 7 years ago

Woot thanks! Will reopen this issue if I see it again