]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile/internal/types2: more systematic error handling in typeWriter
authorRobert Griesemer <gri@golang.org>
Sun, 29 Aug 2021 17:57:06 +0000 (10:57 -0700)
committerRobert Griesemer <gri@golang.org>
Mon, 30 Aug 2021 22:07:53 +0000 (22:07 +0000)
commit3342aa5f51e1299e9d86307e2dbf429cd2aca987
treee437e6002494bee4c9d15eda1406a66fd53db628
parentb06cfe9b25a9cd6ef6ff482b9cd08b2f709131b0
cmd/compile/internal/types2: more systematic error handling in typeWriter

When using a typeWriter for debugging/error message type strings,
it shouldn't crash in the presence of type-checker internal bugs.
But when a typeHasher is used, we don't want to silently ignore
errors.

Introduce an error method that panics in type hashing mode but
prints an error value otherwise.

Also fixed an incorrect 'if' statement in tParamList.

Change-Id: I26c8b8e0b14396e91ad71bf903e36ce1ca55839e
Reviewed-on: https://go-review.googlesource.com/c/go/+/346009
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/typestring.go