Type SymbolTable::lookupType(const std::string& name) const throw() {
pair<vector<Type>, Type> p = (*d_typeMap->find(name)).second;
- Assert(p.first.size() == 0,
- "type constructor arity is wrong: "
- "`%s' requires %u parameters but was provided 0",
- name.c_str(), p.first.size());
+ CheckArgument(p.first.size() == 0, name,
+ "type constructor arity is wrong: "
+ "`%s' requires %u parameters but was provided 0",
+ name.c_str(), p.first.size());
return p.second;
}
Type SymbolTable::lookupType(const std::string& name,
const std::vector<Type>& params) const throw() {
pair<vector<Type>, Type> p = (*d_typeMap->find(name)).second;
- Assert(p.first.size() == params.size(),
- "type constructor arity is wrong: "
- "`%s' requires %u parameters but was provided %u",
+ CheckArgument(p.first.size() == params.size(), params,
+ "type constructor arity is wrong: "
+ "`%s' requires %u parameters but was provided %u",
name.c_str(), p.first.size(), params.size());
if(p.first.size() == 0) {
- Assert(p.second.isSort());
+ CheckArgument(p.second.isSort(), name);
return p.second;
}
if(p.second.isSortConstructor()) {
return instantiation;
} else if(p.second.isDatatype()) {
- Assert( DatatypeType(p.second).isParametric() );
+ CheckArgument(DatatypeType(p.second).isParametric(), name, "expected parametric datatype");
return DatatypeType(p.second).instantiate(params);
} else {
if(Debug.isOn("sort")) {
PARSER_STATE->isDeclared(id, SYM_SORT)) {
Debug("parser-param") << "param: getSort " << id << " " << types.size() << " " << PARSER_STATE->getArity( id )
<< " " << PARSER_STATE->isDeclared(id, SYM_SORT) << std::endl;
+ if(types.size() != PARSER_STATE->getArity(id)) {
+ std::stringstream ss;
+ ss << "incorrect arity for symbol `" << id << "': expected "
+ << PARSER_STATE->getArity( id ) << " type arguments, got "
+ << types.size();
+ PARSER_STATE->parseError(ss.str());
+ }
if(types.size() > 0) {
t = PARSER_STATE->getSort(id, types);
}else{