mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Revert "encoding/json: don't reuse slice elements when decoding"
This reverts https://golang.org/cl/191783. Reason for revert: Broke too many programs which depended on the previous behavior, even when it was the opposite of what the documentation said. We can attempt to fix the original issue again for 1.16, while keeping those programs in mind. Fixes #39427. Change-Id: I7a7f24b2a594c597ef625aeff04fff29aaa88fc6 Reviewed-on: https://go-review.googlesource.com/c/go/+/240657 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
a4ba411b19
commit
5de90d33c8
2 changed files with 19 additions and 36 deletions
|
|
@ -2099,10 +2099,7 @@ func TestSkipArrayObjects(t *testing.T) {
|
|||
// slices, and arrays.
|
||||
// Issues 4900 and 8837, among others.
|
||||
func TestPrefilled(t *testing.T) {
|
||||
type T struct {
|
||||
A, B int
|
||||
}
|
||||
// Values here change, cannot reuse the table across runs.
|
||||
// Values here change, cannot reuse table across runs.
|
||||
var prefillTests = []struct {
|
||||
in string
|
||||
ptr interface{}
|
||||
|
|
@ -2138,16 +2135,6 @@ func TestPrefilled(t *testing.T) {
|
|||
ptr: &[...]int{1, 2},
|
||||
out: &[...]int{3, 0},
|
||||
},
|
||||
{
|
||||
in: `[{"A": 3}]`,
|
||||
ptr: &[]T{{A: -1, B: -2}, {A: -3, B: -4}},
|
||||
out: &[]T{{A: 3}},
|
||||
},
|
||||
{
|
||||
in: `[{"A": 3}]`,
|
||||
ptr: &[...]T{{A: -1, B: -2}, {A: -3, B: -4}},
|
||||
out: &[...]T{{A: 3, B: -2}, {}},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range prefillTests {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue