mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
insert type assertions when narrowing.
R=r OCL=24349 CL=24913
This commit is contained in:
parent
7cd24361bd
commit
49e2087848
17 changed files with 208 additions and 62 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue