Patchwork Go patch committed: Don't let array indexes be untyped

login
register
mail settings
Submitter Ian Taylor
Date Feb. 15, 2011, 7:06 p.m.
Message ID <mcrr5b95d8i.fsf@google.com>
Download mbox | patch
Permalink /patch/83283/
State New
Headers show

Comments

Ian Taylor - Feb. 15, 2011, 7:06 p.m.
For some reason at one time I thought it was OK for array indexes to be
untyped.  That is not the case, and this patch to the Go frontend fixes
it.  Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

Patch

diff -r b78afefb1789 go/expressions.cc
--- a/go/expressions.cc	Tue Feb 15 10:53:53 2011 -0800
+++ b/go/expressions.cc	Tue Feb 15 11:03:36 2011 -0800
@@ -9225,10 +9225,9 @@ 
 Array_index_expression::do_determine_type(const Type_context*)
 {
   this->array_->determine_type_no_context();
-  Type_context subcontext(NULL, true);
-  this->start_->determine_type(&subcontext);
+  this->start_->determine_type_no_context();
   if (this->end_ != NULL)
-    this->end_->determine_type(&subcontext);
+    this->end_->determine_type_no_context();
 }
 
 // Check types of an array index.