]> Cypherpunks repositories - gostls13.git/commit
go/types: better error when converting untyped values in assignments
authorRob Findley <rfindley@google.com>
Sun, 12 Jul 2020 20:57:01 +0000 (16:57 -0400)
committerRobert Findley <rfindley@google.com>
Thu, 27 Aug 2020 16:05:08 +0000 (16:05 +0000)
commit346efc28508dc358cba7e246adeb40bde99cfb2a
tree6db01004ad88145751dba3f7c6ce76aec340f9dc
parent3e636ab9ad31040aff2d484237808907a776cec6
go/types: better error when converting untyped values in assignments

The error returned by convertUntyped is 'cannot convert _ to _', which
can be misleading in contexts where an explicit conversion would be
allowed.

Arguably the error message from convertUntyped should just be 'cannot
use _ as _', as 'convert' has an explicit meaning within the spec.
Making that change caused a large number of test failures, so for now we
just fix this for assignments by interpreting the error.

For #22070

Change-Id: I4eed6f39d1a991e8df7e035ec301d28a05150eb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/242083
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/assignments.go