aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Findley <rfindley@google.com>2021-02-04 12:03:53 -0500
committerRobert Findley <rfindley@google.com>2021-02-09 03:28:12 +0000
commit11d15c171bd25337c1dde25a0f7ce4892cb894bb (patch)
tree55bbee96f13952f8414aa44ebbfc410bae6c18d5
parent618e3c15bdb5c031ac037e7ad5c1b3791a913226 (diff)
downloadgo-11d15c171bd25337c1dde25a0f7ce4892cb894bb.tar.gz
go-11d15c171bd25337c1dde25a0f7ce4892cb894bb.zip
[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>
-rw-r--r--src/go/types/builtins.go4
-rw-r--r--src/go/types/testdata/builtins.src2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/go/types/builtins.go b/src/go/types/builtins.go
index fd35f78676..078ed4488d 100644
--- a/src/go/types/builtins.go
+++ b/src/go/types/builtins.go
@@ -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
}
diff --git a/src/go/types/testdata/builtins.src b/src/go/types/testdata/builtins.src
index 98830eb08c..a7613adc35 100644
--- a/src/go/types/testdata/builtins.src
+++ b/src/go/types/testdata/builtins.src
@@ -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)