insert type assertions when narrowing.

R=r
OCL=24349
CL=24913
This commit is contained in:
Russ Cox 2009-02-11 17:55:16 -08:00
parent 7cd24361bd
commit 49e2087848
17 changed files with 208 additions and 62 deletions

View file

@ -270,7 +270,7 @@ func TestAll(tt *testing.T) { // TODO(r): wrap up better
assert(typ.String(), "[]uint32");
t = reflect.ParseTypeString("", "[]int32");
v := reflect.NewSliceValue(t, 5, 10);
v := reflect.NewSliceValue(t.(ArrayType), 5, 10);
t1 := reflect.ParseTypeString("", "*[]int32");
v1 := reflect.NewInitValue(t1);
if v1 == nil { panic("V1 is nil"); }
@ -308,7 +308,7 @@ func TestCopyArray(t *testing.T) {
}
}
for tocopy := 1; tocopy <= 7; tocopy++ {
vb.(PtrValue).Sub().(ArrayValue).CopyFrom(va.(PtrValue).Sub(), tocopy);
vb.(PtrValue).Sub().(ArrayValue).CopyFrom(va.(PtrValue).Sub().(ArrayValue), tocopy);
for i := 0; i < tocopy; i++ {
if a[i] != b[i] {
t.Errorf("1 tocopy=%d a[%d]=%d, b[%d]=%d",