]> Cypherpunks.ru repositories - gostls13.git/commit
go/types: tweaks to ArgumentError to be more idiomatic
authorRobert Findley <rfindley@google.com>
Tue, 21 Sep 2021 22:15:25 +0000 (18:15 -0400)
committerRobert Findley <rfindley@google.com>
Wed, 22 Sep 2021 01:41:09 +0000 (01:41 +0000)
commit3664950ef68089716b9f22062db66a347c7246d4
tree44ca55d33267d9171d37d339e083a4169346d456
parent04572fa29ba689dcdd098cc6b7f84307bf1e171b
go/types: tweaks to ArgumentError to be more idiomatic

This CL makes a few changes to the new ArgumentError type to be more
idiomatic:
 - Use a pointer receiver for methods.
 - Export fields, similarly to Error. ArgumentError has a clear meaning
   (an error associated with an index), so there is no need to hide its
   representation.
 - Add an Unwrap method to access the underlying error.
 - Say explicitly that the error returned from Instantiate may wrap
   *ArgumentError. There is no need to commit to an API that always
   returns an error with dynamic type *ArgumentError.

Updates #47916

Change-Id: Ib1a43e921f247794e7155280ccbf5a6775ed3978
Reviewed-on: https://go-review.googlesource.com/c/go/+/351335
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/api.go
src/go/types/api_test.go
src/go/types/instantiate.go