In a condition {% if (a || b) && (c || d) %}, rinja ensures that the whole expression P is a bool by (de)referencing as needed: *((&P) as &bool). I think it would be better if each term was "boolified" B:
-B((a || b) && (c || d))
+B((B(a) || B(b)) && (B(C) || B(D)))
This "boolification" should be done for the outmost term of a condition, and any nested conjuctions and disjuctions. Any sub-expression that is not …||…, …&&… or !… should end the recursive boolification.
Compare redlib-org/redlib#290.