]> Cypherpunks.ru repositories - gostls13.git/commit
reflect: fix ArenaNew to match documentation
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 8 Jun 2023 18:40:31 +0000 (18:40 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 16 Jun 2023 17:08:43 +0000 (17:08 +0000)
commit2b0ff4b629cc86139e719b92e5fc94950c19b5c7
tree243d363f13a9b8ca7eaff897bebe1b36085e16bf
parent4eceefa3388c11afc2b71302de53cac921f7f439
reflect: fix ArenaNew to match documentation

Currently ArenaNew expects the type passed in to be a *T and it returns
a *T. This does not match the function's documentation.

Since this is an experiment, change ArenaNew to match the documentation.
This more closely aligns ArenaNew with arena.New. (Takes a type T,
returns a *T value.)

Note that this is a breaking change. However, as far as pkg.go.dev can
tell, there's exactly one package using it in the open source world.

Also, add smoke test for the exported API, which is just a wrapper
around the internal API. Clearly there's enough room for error here that
it should be tested, but we don't need thorough tests at this layer
because that already exists in the runtime. We just need to make sure it
basically works.

Fixes #60528.

Change-Id: I673cc4609378380ef80648b0c2eb2928e73f49c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/501860
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/internal/testdir/testdir_test.go
src/reflect/arena.go
test/arenas/smoke.go [new file with mode: 0644]