]> Cypherpunks repositories - gostls13.git/commit
go/types: factor out usage of implicit type
authorRob Findley <rfindley@google.com>
Mon, 13 Jul 2020 02:36:34 +0000 (22:36 -0400)
committerRobert Findley <rfindley@google.com>
Fri, 28 Aug 2020 16:45:21 +0000 (16:45 +0000)
commit42e09dc1ba1e820af44b2cbd4db0d60abb5559a2
tree14142f321ddb8ad835fe457bf1eb5fbbd7dfc329
parentae7b6a3b779c4d6de96f59efbfed0b899c3ff6df
go/types: factor out usage of implicit type

There was some duplication of logic interpreting the implicit type of
an operand in assignableTo and convertUntyped. Factor out this logic to
a new 'implicitType' function, which returns the implicit type of an
untyped operand when used in a context where a target type is expected.
I believe this resolves some comments about code duplication. There is
other similar code in assignable, assignableTo, and convertUntypes, but
I found it to to be sufficiently semantically distinct to not warrant
factoring out.

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