Remove duplicate compiling of task when: statements

Fixes #8538