aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/subr.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-07-20 13:28:12 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-07-20 23:11:40 +0000
commit6a931673f0b655e7ca538826af21a54d3f958070 (patch)
treed9806af76a3fb757865976188e0565ae69ee29a5 /src/cmd/compile/internal/typecheck/subr.go
parente4994e71fb1809d8ce7df89e471586e05797e171 (diff)
downloadgo-6a931673f0b655e7ca538826af21a54d3f958070.tar.gz
go-6a931673f0b655e7ca538826af21a54d3f958070.zip
[dev.typeparams] cmd/compile: add base.Assertf{,At} functions
We have almost 200 uses of the "assert" helper functions in noder and typecheck. Clearly the tiny bit of extra convenience of writing a one-line assertion rather than an if+panic is helpful, so we might as well add functions for this to base itself so that it's easier to write more informative error messages. Change-Id: I06e2db2f0455af063937b25a53ca42f9413cf496 Reviewed-on: https://go-review.googlesource.com/c/go/+/336050 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/subr.go')
-rw-r--r--src/cmd/compile/internal/typecheck/subr.go4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/typecheck/subr.go b/src/cmd/compile/internal/typecheck/subr.go
index d9e6612dfc..a795524b2b 100644
--- a/src/cmd/compile/internal/typecheck/subr.go
+++ b/src/cmd/compile/internal/typecheck/subr.go
@@ -981,9 +981,7 @@ func MakeDictName(gf *types.Sym, targs []*types.Type, hasBrackets bool) *types.S
}
func assert(p bool) {
- if !p {
- panic("assertion failed")
- }
+ base.Assert(p)
}
// General type substituter, for replacing typeparams with type args.