diff options
author | Robert Griesemer <gri@golang.org> | 2021-03-17 22:13:16 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-03-23 05:11:09 +0000 |
commit | 8f19394b62a5b1651cd66eefb1bfeacc278966b9 (patch) | |
tree | af9e7e1c97239a9283eedd30c49f437e4acb054d /src/cmd/compile/internal/types2/call.go | |
parent | 0265b6475f08f2c23a742132db87c357fcbfa458 (diff) | |
download | go-8f19394b62a5b1651cd66eefb1bfeacc278966b9.tar.gz go-8f19394b62a5b1651cd66eefb1bfeacc278966b9.zip |
cmd/compile/internal/types2: refactor untyped conversions
Based on https://golang.org/cl/284256 for go/types.
Brings this code more in line with go/types.
Adjusted various tests to match new error messages which
generally are now better: for assignment errors, instead
of a generic "cannot convert" we now say "cannot use"
followed by a clearer reason as to why not.
Major differences to go/types with respect to the changed
files:
- Some of the new code now returns error codes, but they
are only used internally for now, and not reported with
errors.
- go/types does not "convert" untyped nil values to target
types, but here we do. This is unchanged from how types2
handled this before this CL.
Change-Id: If45336d7ee679ece100f6d9d9f291a6ea55004d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/302757
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/call.go')
-rw-r--r-- | src/cmd/compile/internal/types2/call.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types2/call.go b/src/cmd/compile/internal/types2/call.go index 2ee22c8a19..18737e45a0 100644 --- a/src/cmd/compile/internal/types2/call.go +++ b/src/cmd/compile/internal/types2/call.go @@ -426,7 +426,7 @@ func (check *Checker) arguments(call *syntax.CallExpr, sig *Signature, args []*o // check arguments for i, a := range args { - check.assignment(a, sigParams.vars[i].typ, "argument") + check.assignment(a, sigParams.vars[i].typ, check.sprintf("argument to %s", call.Fun)) } return |