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

Trying to negate a value fails unexpectedly #871

Open
bluenote10 opened this issue Oct 29, 2023 · 0 comments
Open

Trying to negate a value fails unexpectedly #871

bluenote10 opened this issue Oct 29, 2023 · 0 comments

Comments

@bluenote10
Copy link

I'm completely new to tera so I may be doing something stupid. I've narrowed the reproduction down to having this macro:

{% macro try_to_negate_value(value) %}
  {{ -value }}
{% endmacro try_to_negate_value %}

and using it like this:

{% import "my_macros" as macros %}
{{ macros::try_to_negate_value(value=42) }}

This panics with

  --> 33:6
   |
33 |   {{ -value }}
   |      ^---
   |
   = expected a value that can be negated or an array of values

When removing the minus sign everything works fine, but I don't understand why 42 cannot be negated. A floating point value doesn't work either.

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

No branches or pull requests

1 participant