Patchwork Go patch committed: Fix type of string slice

login
register
mail settings
Submitter Ian Taylor
Date Jan. 14, 2011, 5:37 a.m.
Message ID <mcrei8gm4fm.fsf@google.com>
Download mbox | patch
Permalink /patch/78862/
State New
Headers show

Comments

Ian Taylor - Jan. 14, 2011, 5:37 a.m.
When taking a slice of a string, the type of the result is the type of
the string, which matters if it is a named type.  The Go frontend got
this wrong, and this patch corrects it.  Bootstrapped and tested on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch

diff -r a8e0fd59797d go/expressions.cc
--- a/go/expressions.cc	Thu Jan 13 16:54:22 2011 -0800
+++ b/go/expressions.cc	Thu Jan 13 21:32:14 2011 -0800
@@ -9541,7 +9541,7 @@ 
   if (this->end_ == NULL)
     return Type::lookup_integer_type("uint8");
   else
-    return Type::make_string_type();
+    return this->string_->type();
 }
 
 // Determine the type of a string index.