def do_work(hash : Hash(String, String)); end
do_work {"foo" => "bar"}
Syntax error in eval:3: unexpected token: =>
Assigning the hash to a variable first or adding parentheses to the method invocation works.
I guess that's because parentheses are also used for blocks.
Yes, this a limitation in the grammar.
To expand on why this is unsolvable, otherwise the compiler will need to special-case this with 3-level deep lookahead. Which is usually seen as a very bad thing (sorry for not expanding on that one).
do_work { could be both
do_work {"foo" could be both
do_work {"foo" = could be both
do_work {"foo" => ok right, now I can go back and actually parse this as Hash
Duplicate of #6224, #2746, #4826, #1051
Most helpful comment
Duplicate of #6224, #2746, #4826, #1051