Correctly use a pattern variable in tc-app-apply.

Closes PR 14508.