def _parse_type_with_init(self, named: Union[(bool, str)], outer: str) -> Union[(ASTTypeWithInit, ASTTemplateParamConstrainedTypeWithInit)]:
    if outer:
        assert (outer in ('type', 'member', 'function', 'templateParam'))
    type = self._parse_type(outer=outer, named=named)
    if (outer != 'templateParam'):
        init = self._parse_initializer(outer=outer)
        return ASTTypeWithInit(type, init)
    pos = self.pos
    eExpr = None
    try:
        init = self._parse_initializer(outer=outer, allowFallback=False)
        if (init is None):
            return ASTTypeWithInit(type, None)
        self.skip_ws()
        if ((self.current_char != ',') and (self.current_char != '>')):
            self.pos = pos
            init = None
        else:
            return ASTTypeWithInit(type, init)
    except DefinitionError as e:
        self.pos = pos
        eExpr = e
    if (not self.skip_string('=')):
        return ASTTypeWithInit(type, None)
    try:
        typeInit = self._parse_type(named=False, outer=None)
        return ASTTemplateParamConstrainedTypeWithInit(type, typeInit)
    except DefinitionError as eType:
        if (eExpr is None):
            raise eType
        errs = []
        errs.append((eExpr, 'If default template argument is an expression'))
        errs.append((eType, 'If default template argument is a type'))
        msg = 'Error in non-type template parameter'
        msg += ' or constrained template parameter.'
        raise self._make_multi_error(errs, msg)
def _parse_type_with_init(self, named: Union[(bool, str)], outer: str) -> Union[(ASTTypeWithInit, ASTTemplateParamConstrainedTypeWithInit)]:
    if outer:
        assert (outer in ('type', 'member', 'function', 'templateParam'))
    type = self._parse_type(outer=outer, named=named)
    if (outer != 'templateParam'):
        init = self._parse_initializer(outer=outer)
        return ASTTypeWithInit(type, init)
    pos = self.pos
    eExpr = None
    try:
        init = self._parse_initializer(outer=outer, allowFallback=False)
        if (init is None):
            return ASTTypeWithInit(type, None)
        self.skip_ws()
        if ((self.current_char != ',') and (self.current_char != '>')):
            self.pos = pos
            init = None
        else:
            return ASTTypeWithInit(type, init)
    except DefinitionError as e:
        self.pos = pos
        eExpr = e
    if (not self.skip_string('=')):
        return ASTTypeWithInit(type, None)
    try:
        typeInit = self._parse_type(named=False, outer=None)
        return ASTTemplateParamConstrainedTypeWithInit(type, typeInit)
    except DefinitionError as eType:
        if (eExpr is None):
            raise eType
        errs = []
        errs.append((eExpr, 'If default template argument is an expression'))
        errs.append((eType, 'If default template argument is a type'))
        msg = 'Error in non-type template parameter'
        msg += ' or constrained template parameter.'
        raise self._make_multi_error(errs, msg)