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

OpAssign in macros doesn't work for container types #11846

Open
Blacksmoke16 opened this issue Feb 21, 2022 · 0 comments
Open

OpAssign in macros doesn't work for container types #11846

Blacksmoke16 opened this issue Feb 21, 2022 · 0 comments

Comments

@Blacksmoke16
Copy link
Member

#9409 made it so OpAssign are supported in macro land. However it doesn't seem to work when using it with a container type, like HashLiteral or NamedTupleLiteral:

{% begin %}
  {% hash = {} of Nil => Nil %}
  
  {% pp(hash["foo"] ||= {"id" => 1}) %}
{% end %}

Produces: Error: undefined macro method 'HashLiteral#[]?'.

This seems to be because, unlike the related stdlib types, the macro variants do not have a #[]? method as they rely solely on #[]. Either need to have the op assign logic account for that, or could just add #[]? as an undocumented alias on the macro types.

Discovered via athena-framework/athena#151.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant