def VisitSignature(self, sig):
    new_template = []
    substitutions = {k: k for k in self.type_params_stack[(- 1)]}
    for item in sig.template:
        new_template += self._ReplaceByOuterIfNecessary(item, substitutions)
    if (sig.template == new_template):
        return sig
    else:
        return sig.Replace(template=tuple(new_template)).Visit(visitors.ReplaceTypeParameters(substitutions)).Visit(SimplifyUnions())
def VisitSignature(self, sig):
    new_template = []
    substitutions = {k: k for k in self.type_params_stack[(- 1)]}
    for item in sig.template:
        new_template += self._ReplaceByOuterIfNecessary(item, substitutions)
    if (sig.template == new_template):
        return sig
    else:
        return sig.Replace(template=tuple(new_template)).Visit(visitors.ReplaceTypeParameters(substitutions)).Visit(SimplifyUnions())