areusch commented on a change in pull request #5417:
URL: https://github.com/apache/incubator-tvm/pull/5417#discussion_r415970964



##########
File path: src/ir/error.cc
##########
@@ -62,16 +62,21 @@ void ErrorReporter::RenderErrors(const IRModule& module, 
bool use_color) {
 
     CHECK(has_errs != this->node_to_error_.end());
 
-    const auto& error_indicies = has_errs->second;
+    const auto& error_indices = has_errs->second;
 
     std::stringstream err_msg;
 
-    err_msg << rang::fg::red;
-    err_msg << " ";
-    for (auto index : error_indicies) {
-      err_msg << this->errors_[index].what() << "; ";
+    if (error_indices.size() != 0) {
+      err_msg << rang::fg::red;
+      err_msg << " ";
+      // the errors are in reverse order, so print them with a reversed 
iteration
+      err_msg << this->errors_[error_indices[error_indices.size()-1]].what();
+      for (int i = error_indices.size() - 2; i >= 0; i--) {
+        size_t err_idx = error_indices[i];
+        err_msg << "; " << this->errors_[err_idx].what();
+      }
+      err_msg << rang::fg::reset;

Review comment:
       reverted




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to