Fix problem with variable shadowing when instantiating aliased types