compiler: propagate array length error marker farther Fixes golang/go#53639 Change-Id: I4d020d797f4ba5fb57f88aeaeb4188b1dabd3b9b Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415936 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
diff --git a/go/expressions.cc b/go/expressions.cc index 00d35a9..2492d9f 100644 --- a/go/expressions.cc +++ b/go/expressions.cc
@@ -8486,6 +8486,11 @@ pa != this->args()->end(); ++pa) { + if ((*pa)->is_error_expression()) + { + go_assert(saw_errors()); + return Expression::make_error(loc); + } if ((*pa)->is_nil_expression()) { Expression* nil = Expression::make_nil(loc); @@ -13391,6 +13396,7 @@ if (array_type == NULL) { go_assert(this->array_->type()->is_error()); + this->set_is_error(); return; }
diff --git a/go/types.cc b/go/types.cc index 4995283..9f34801 100644 --- a/go/types.cc +++ b/go/types.cc
@@ -7429,7 +7429,10 @@ Array_type::do_verify() { if (this->element_type()->is_error_type()) - return false; + { + this->set_is_error(); + return false; + } if (!this->verify_length()) { this->length_ = Expression::make_error(this->length_->location());