Go patch committed: Fix type of string slice

Submitted by Ian Taylor on Jan. 14, 2011, 5:37 a.m.

Details

Message ID mcrei8gm4fm.fsf@google.com
State New
Headers show

Commit Message

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 hide | download patch | download mbox

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.