mirror of git://gcc.gnu.org/git/gcc.git
Improve error for undefined name in imported package.
Avoid emitting some followon errors. From-SVN: r179020
This commit is contained in:
parent
6fa2979911
commit
02a728277f
|
@ -9730,7 +9730,10 @@ Call_result_expression::do_type()
|
||||||
if (fntype == NULL)
|
if (fntype == NULL)
|
||||||
{
|
{
|
||||||
if (ce->issue_error())
|
if (ce->issue_error())
|
||||||
this->report_error(_("expected function"));
|
{
|
||||||
|
if (!ce->fn()->type()->is_error())
|
||||||
|
this->report_error(_("expected function"));
|
||||||
|
}
|
||||||
this->set_is_error();
|
this->set_is_error();
|
||||||
return Type::make_error_type();
|
return Type::make_error_type();
|
||||||
}
|
}
|
||||||
|
@ -10043,7 +10046,9 @@ Array_index_expression::do_check_types(Gogo*)
|
||||||
this->report_error(_("index must be integer"));
|
this->report_error(_("index must be integer"));
|
||||||
if (this->end_ != NULL
|
if (this->end_ != NULL
|
||||||
&& this->end_->type()->integer_type() == NULL
|
&& this->end_->type()->integer_type() == NULL
|
||||||
&& !this->end_->is_nil_expression())
|
&& !this->end_->type()->is_error()
|
||||||
|
&& !this->end_->is_nil_expression()
|
||||||
|
&& !this->end_->is_error_expression())
|
||||||
this->report_error(_("slice end must be integer"));
|
this->report_error(_("slice end must be integer"));
|
||||||
|
|
||||||
Array_type* array_type = this->array_->type()->array_type();
|
Array_type* array_type = this->array_->type()->array_type();
|
||||||
|
|
|
@ -335,10 +335,17 @@ Parse::type_name(bool issue_error)
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
if (named_object == NULL)
|
if (named_object == NULL)
|
||||||
{
|
{
|
||||||
if (package != NULL)
|
if (package == NULL)
|
||||||
ok = false;
|
|
||||||
else
|
|
||||||
named_object = this->gogo_->add_unknown_name(name, location);
|
named_object = this->gogo_->add_unknown_name(name, location);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const std::string& packname(package->package_value()->name());
|
||||||
|
error_at(location, "reference to undefined identifer %<%s.%s%>",
|
||||||
|
Gogo::message_name(packname).c_str(),
|
||||||
|
Gogo::message_name(name).c_str());
|
||||||
|
issue_error = false;
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (named_object->is_type())
|
else if (named_object->is_type())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue