Closed Folyd closed 1 year ago
I would be okay changing this to a compile time error as Jinja2 also forced the error (unknown filter or test) already at compile time.
I looked into this briefly and I think the changes necessary to eagerly detect this are probably not worth the effort. The code generator is intentionally infallible which leaves two places where this check could happen:
Either of those cases are abstraction wise quite far from the environments and multiple layers would have to be changed for that. This is particularly bad for the source abstraction which parses the templates and is itself held by the environment, but does not have access to the environment.
The best that could be done is run a validation step early before the template render, but that sounds like a quite expensive step.
I'm going to close this as WONTFIX given the cost and complexity associated with this.
Lazy syntax evaluation could cause it hard to find the bugs, for example,
trim_start_matches
is not a built-in filter forminijinja
, however, it didn't report an error until theif
condition is met.