]> Cypherpunks.ru repositories - gostls13.git/commit
reflect: add Value.{CanInt, CanUint, CanFloat, CanComplex}
authorFabio Falzoi <fabio.falzoi84@gmail.com>
Sat, 25 Sep 2021 16:44:24 +0000 (18:44 +0200)
committerIan Lance Taylor <iant@golang.org>
Mon, 27 Sep 2021 21:31:14 +0000 (21:31 +0000)
commit04f7521b0aef10d523d6de006e723afd349b4b95
tree1f24febcd49b01f83cfa091d2d4a3e8eb19ac005
parent8e34d779578736942c78f9857f5bb9b9025815c6
reflect: add Value.{CanInt, CanUint, CanFloat, CanComplex}

As discussed in #47658, Value already has CanAddr and CanInterface to
test if a call to Addr or Inteface, respectively, does not result in a
panic.
Therefore we add CanInt, CanUint, CanFloat and CanComplex to ease the
test for a possible panic in calling, respectively, Int, Uint, Float and
Complex.

Fixes #47658

Change-Id: I58b77d77e6eec9f34234e985f631eab72b5b935e
Reviewed-on: https://go-review.googlesource.com/c/go/+/352131
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: David Chase <drchase@google.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/test/inl_test.go
src/reflect/all_test.go
src/reflect/value.go