* fix term rewriting with sideeffect fix #6217 * add tests * Update tests/template/template_various.nim