Yes, it’s a tuple not a map, and not even a tuple, because tuple doesn’t have %{.
I did it accidentally and it took time to catch the mistake. I wanted to see if someone else can catch the mistake, because the error message doesn’t specifically point it out.
%{"#{ isn’t even needed, using key directly works.
for {key, val} <- %{"a" => 1, "b" => 2}, do: %{key => val * val} works.
It’s interesting that the first syntax error points to the end of the malformed map, but the second one to the correct place, at the comma. Perhaps a bug because of the for comprehension?
Due to the for comprehension, yes, but I would hesitate to label it a bug. for is a macro, and the code is being received as quoted expressions. I’ve written macros but my knowledge is not very deep to understand error handling and introspection. The pointer seems to be pointing more generally to the offending expression, maybe because of how these details are implemented