mirror of
https://github.com/golang/go
synced 2024-11-17 13:54:46 -07:00
[dev.regabi] go/types: convert untyped arguments to delete
This is a port of CL 285059 to go/types. The error assertion is updated to match go/types error for assignment, which has been improved. Change-Id: Icdd2751edea0abef7c84feadcbf9265d71239ade Reviewed-on: https://go-review.googlesource.com/c/go/+/289716 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
618e3c15bd
commit
11d15c171b
@ -353,8 +353,8 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
|
||||
return
|
||||
}
|
||||
|
||||
if ok, code := x.assignableTo(check, m.key, nil); !ok {
|
||||
check.invalidArg(x, code, "%s is not assignable to %s", x, m.key)
|
||||
check.assignment(x, m.key, "argument to delete")
|
||||
if x.mode == invalid {
|
||||
return
|
||||
}
|
||||
|
||||
|
2
src/go/types/testdata/builtins.src
vendored
2
src/go/types/testdata/builtins.src
vendored
@ -283,7 +283,7 @@ func delete1() {
|
||||
delete() // ERROR not enough arguments
|
||||
delete(1) // ERROR not enough arguments
|
||||
delete(1, 2, 3) // ERROR too many arguments
|
||||
delete(m, 0 /* ERROR not assignable */)
|
||||
delete(m, 0 /* ERROR cannot use */)
|
||||
delete(m, s)
|
||||
_ = delete /* ERROR used as value */ (m, s)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user