Handle parens in predicates when converting to TH

This fixes Trac #8625