wolfendale / scala-nunjucks

5 stars 1 forks source link

Remove literal expressions for Infinity and NaN #11

Closed wolfendale closed 4 years ago

wolfendale commented 4 years ago

It seems in the nunjucks expression language NaN and Infinity can't be parsed as constants and instead are parsed as references to (usually) undefined properties.

This means that when an expression is output like {{ Infinity }} it outputs nothing. Whereas {{ 1 / 0 }} outputs Infinity. This shows that Infinity can still arise as a value but can't be expressed as a literal.

Likewise, {{ NaN }} outputs nothing where {{ +'asdf' }} outputs NaN.

To fix this, we should remove these literals from the expression parser.