Fix for pattern vars in transforms

We'll need this when making rewrite rules for partially evaluating type
class dictionaries.