break;
case OSLICE:
- args = list1(n->left);
+ r = nod(OCONV, n->left, N);
+ r->type = types[TSTRING];
+ args = list1(r);
// sys_slicestring(s, lb, hb)
r = nod(OCONV, n->right->left, N);
case OINDEX:
// sys_indexstring(s, i)
- args = list1(n->left);
+ r = nod(OCONV, n->left, N);
+ r->type = types[TSTRING];
+ args = list1(r);
+
r = nod(OCONV, n->right, N);
r->type = types[TINT];
args = list(args, r);
break;
case OARRAY:
- r = n->left;
// arraystring([]byte) string;
on = syslook("arraystring", 0);
+ r = n->left;
+
if(r->type != T && r->type->type != T) {
if(istype(r->type->type, TINT) || istype(r->type->type->type, TINT)) {
// arraystring([]byte) string;
tempname(ohk, types[TINT]);
ha = nod(OXXX, N, N); // hidden string
- tempname(ha, t);
+ tempname(ha, types[TSTRING]);
hv = N;
if(v != N) {
}
// ha = s
- a = nod(OAS, ha, m);
+ a = nod(OCONV, m, N);
+ a->type = ha->type;
+ a = nod(OAS, ha, a);
init = list(init, a);
// ohk = 0
--- /dev/null
+// $G $D/$F.go || echo BUG: bug173
+
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// these used to fail because the runtime
+// functions that get called to implement them
+// expected string, not T.
+
+package main
+
+type T string
+func main() {
+ var t T = "hello";
+ println(t[0:4], t[4]);
+ for i, x := range t {
+ }
+ for i := range t {
+ }
+}