1
0
mirror of https://github.com/golang/go synced 2024-11-22 16:34:47 -07:00

[dev.typeparams] cmd/compile/internal/syntax: 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
is not helpful.

Matches the types2 changes made in https://golang.org/cl/339969 .

Change-Id: Icb34a9daab981a84f41f8ae7ae5dc1b85b2d2c81
Reviewed-on: https://go-review.googlesource.com/c/go/+/339904
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Robert Griesemer 2021-08-04 21:17:54 -07:00
parent c3b57af8bc
commit 3a9fd99849
3 changed files with 4 additions and 4 deletions

View File

@ -604,7 +604,7 @@ func (p *parser) typeDecl(group *Group) Decl {
} else {
// x is the array length expression
if debug && x == nil {
panic("internal error: nil expression")
panic("length expression is nil")
}
d.Type = p.arrayType(pos, x)
}

View File

@ -12,7 +12,7 @@ func StartPos(n Node) Pos {
for m := n; ; {
switch n := m.(type) {
case nil:
panic("internal error: nil")
panic("nil node")
// packages
case *File:
@ -124,7 +124,7 @@ func EndPos(n Node) Pos {
for m := n; ; {
switch n := m.(type) {
case nil:
panic("internal error: nil")
panic("nil node")
// packages
case *File:

View File

@ -70,7 +70,7 @@ type walker struct {
func (w walker) node(n Node) {
if n == nil {
panic("invalid syntax tree: nil node")
panic("nil node")
}
w.v = w.v.Visit(n)