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

Unary minus binds too loosely #893

Closed
tkindy opened this issue Jul 20, 2022 · 1 comment · Fixed by #895 or #902
Closed

Unary minus binds too loosely #893

tkindy opened this issue Jul 20, 2022 · 1 comment · Fixed by #895 or #902
Assignees
Labels

Comments

@tkindy
Copy link
Contributor

tkindy commented Jul 20, 2022

Consider the following expression:

{{ -1 is integer }}

I would expect this to evaluate to true, since -1 is an integer. However, this actually throws an error.

Exception in thread "main" com.hubspot.jinjava.interpret.FatalTemplateErrorsException: Cannot negate 'class java.lang.Boolean'
	at com.hubspot.jinjava.Jinjava.render(Jinjava.java:192)
	at Scratch.main(scratch.java:6)

This implies that the unary minus is binding looser than the is operator. That is, Jinjava interprets that expression the same as -(1 is integer) when it should interpret it as (-1) is integer.

@tkindy
Copy link
Contributor Author

tkindy commented Jul 22, 2022

I had to revert #895 while we look into some templates that no longer parse successfully with these changes.

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