diff options
author | Robert Griesemer <gri@golang.org> | 2021-08-04 12:57:23 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-08-05 19:37:01 +0000 |
commit | f78d538858a2d9aae975b2e2c144d23bcc22c22e (patch) | |
tree | 1db864f65d92302851e6f8a359e2caeec94f7bf2 /src/cmd/compile/internal/types2/typeparam.go | |
parent | c5b6c36ddd0ecdee401c4e78da1addf64bdc6376 (diff) | |
download | go-f78d538858a2d9aae975b2e2c144d23bcc22c22e.tar.gz go-f78d538858a2d9aae975b2e2c144d23bcc22c22e.zip |
[dev.typeparams] cmd/compile/internal/types2: cleanup panic calls
End-users are not expected to deal with the details of panics,
so providing extra information such as an "internal error" prefix
or the name of the function invoking the panic are not helpful.
Remove unnecessary panic verbiage if it is readily available from
a stack trace (such as the function where it happens, and the fact
that is is an "internal error").
Change-Id: I5f86bae6d2cca7c04ce692d17257da7ddee206d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/339969
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/typeparam.go')
-rw-r--r-- | src/cmd/compile/internal/types2/typeparam.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/types2/typeparam.go b/src/cmd/compile/internal/types2/typeparam.go index 27e6e35588..12513ed6dd 100644 --- a/src/cmd/compile/internal/types2/typeparam.go +++ b/src/cmd/compile/internal/types2/typeparam.go @@ -75,7 +75,7 @@ func (t *TypeParam) Constraint() Type { // SetConstraint sets the type constraint for t. func (t *TypeParam) SetConstraint(bound Type) { if bound == nil { - panic("types2.TypeParam.SetConstraint: bound must not be nil") + panic("nil constraint") } t.bound = bound } @@ -118,7 +118,7 @@ func bindTParams(list []*TypeName) *TypeParams { for i, tp := range list { typ := tp.Type().(*TypeParam) if typ.index >= 0 { - panic("internal error: type parameter bound more than once") + panic("type parameter bound more than once") } typ.index = i } |