mirror of
https://github.com/golang/go
synced 2024-11-23 00:50:05 -07:00
go/types, types2: don't crash when using trace with an invalid argument
This only affects tests, typically manual tests, but when using trace we're debugging and we don't want to crash because of trace itself. No test because a test would cause trace output. Manually verified. Fixes #60649. Change-Id: I97abdb94db05774801ec5da56171f4a1aff35615 Reviewed-on: https://go-review.googlesource.com/c/go/+/501415 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Robert Griesemer <gri@google.com>
This commit is contained in:
parent
d6d0fec43d
commit
ea51e92c8a
@ -893,6 +893,9 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
|
||||
check.dump("%v: %s", atPos(x1), x1)
|
||||
x1 = &t // use incoming x only for first argument
|
||||
}
|
||||
if x.mode == invalid {
|
||||
return
|
||||
}
|
||||
// trace is only available in test mode - no need to record signature
|
||||
|
||||
default:
|
||||
|
@ -892,6 +892,9 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
|
||||
check.dump("%v: %s", x1.Pos(), x1)
|
||||
x1 = &t // use incoming x only for first argument
|
||||
}
|
||||
if x.mode == invalid {
|
||||
return
|
||||
}
|
||||
// trace is only available in test mode - no need to record signature
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user