mirror of
https://github.com/golang/go
synced 2024-11-02 09:28:34 +00:00
[dev.typeparams] cmd/compile/internal/ir: more useful Fatalfs
This CL just adds some additional details to existing Fatalf messages that make them more useful for identifying what went wrong. Change-Id: Icba0d943ccfb1b810a1ede0977cc8cf22b2afde5 Reviewed-on: https://go-review.googlesource.com/c/go/+/320612 Trust: Matthew Dempsky <mdempsky@google.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
c7dd3e305d
commit
f208f1ac99
3 changed files with 3 additions and 3 deletions
|
@ -279,7 +279,7 @@ func FuncSymName(s *types.Sym) string {
|
||||||
// MarkFunc marks a node as a function.
|
// MarkFunc marks a node as a function.
|
||||||
func MarkFunc(n *Name) {
|
func MarkFunc(n *Name) {
|
||||||
if n.Op() != ONAME || n.Class != Pxxx {
|
if n.Op() != ONAME || n.Class != Pxxx {
|
||||||
base.Fatalf("expected ONAME/Pxxx node, got %v", n)
|
base.FatalfAt(n.Pos(), "expected ONAME/Pxxx node, got %v (%v/%v)", n, n.Op(), n.Class)
|
||||||
}
|
}
|
||||||
|
|
||||||
n.Class = PFUNC
|
n.Class = PFUNC
|
||||||
|
|
|
@ -563,7 +563,7 @@ func OuterValue(n Node) Node {
|
||||||
for {
|
for {
|
||||||
switch nn := n; nn.Op() {
|
switch nn := n; nn.Op() {
|
||||||
case OXDOT:
|
case OXDOT:
|
||||||
base.Fatalf("OXDOT in walk")
|
base.FatalfAt(n.Pos(), "OXDOT in walk: %v", n)
|
||||||
case ODOT:
|
case ODOT:
|
||||||
nn := nn.(*SelectorExpr)
|
nn := nn.(*SelectorExpr)
|
||||||
n = nn.X
|
n = nn.X
|
||||||
|
|
|
@ -66,7 +66,7 @@ func Float64Val(v constant.Value) float64 {
|
||||||
|
|
||||||
func AssertValidTypeForConst(t *types.Type, v constant.Value) {
|
func AssertValidTypeForConst(t *types.Type, v constant.Value) {
|
||||||
if !ValidTypeForConst(t, v) {
|
if !ValidTypeForConst(t, v) {
|
||||||
base.Fatalf("%v does not represent %v", t, v)
|
base.Fatalf("%v does not represent %v (%v)", t, v, v.Kind())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue