Generate proper error messages for invalid dynamic array initialisers.

Invalid user code should not result in an "internal_error".
This commit is contained in:
Martin Whitaker 2017-10-08 12:59:30 +01:00
parent e315cafa01
commit 8a36849fda
1 changed files with 8 additions and 8 deletions

View File

@ -3448,29 +3448,29 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
} }
if (net == 0) { if (net == 0) {
cerr << get_fileline() << ": internal error: " cerr << get_fileline() << ": error: Unable to bind variable `"
<< "Expecting idents with ntype to be signals." << endl; << path_ << "' in `" << scope_path(use_scope) << "'" << endl;
des->errors += 1; des->errors += 1;
return 0; return 0;
} }
if (! ntype->type_compatible(net->net_type())) { if (! ntype->type_compatible(net->net_type())) {
cerr << get_fileline() << ": internal_error: " cerr << get_fileline() << ": error: the type of the variable '"
<< "net type doesn't match context type." << endl; << path_ << "' doesn't match the context type." << endl;
cerr << get_fileline() << ": : " cerr << get_fileline() << ": : " << "variable type=";
<< "net type=";
if (net->net_type()) if (net->net_type())
net->net_type()->debug_dump(cerr); net->net_type()->debug_dump(cerr);
else else
cerr << "<nil>"; cerr << "<nil>";
cerr << endl; cerr << endl;
cerr << get_fileline() << ": : " cerr << get_fileline() << ": : " << "context type=";
<< "context type=";
ivl_assert(*this, ntype); ivl_assert(*this, ntype);
ntype->debug_dump(cerr); ntype->debug_dump(cerr);
cerr << endl; cerr << endl;
des->errors += 1;
return 0;
} }
ivl_assert(*this, ntype->type_compatible(net->net_type())); ivl_assert(*this, ntype->type_compatible(net->net_type()));