mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: improved error message when calling a shadowed builtin
Otherwise, the error can be confusing if one forgets or doesn't know that the builtin is being shadowed, which is not common practice. Fixes #22822. Change-Id: I735393b5ce28cb83815a1c3f7cd2e7bb5080a32d Reviewed-on: https://go-review.googlesource.com/97455 Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
4b1d704d14
commit
1e308fbc1a
3 changed files with 36 additions and 1 deletions
|
|
@ -65,6 +65,17 @@ var builtinFuncs = [...]struct {
|
|||
{"recover", ORECOVER},
|
||||
}
|
||||
|
||||
// isBuiltinFuncName reports whether name matches a builtin function
|
||||
// name.
|
||||
func isBuiltinFuncName(name string) bool {
|
||||
for _, fn := range builtinFuncs {
|
||||
if fn.name == name {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var unsafeFuncs = [...]struct {
|
||||
name string
|
||||
op Op
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue