]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/types2: clarify is/underIs semantics and implementation
authorRobert Griesemer <gri@golang.org>
Mon, 25 Oct 2021 16:13:16 +0000 (09:13 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 27 Oct 2021 20:24:28 +0000 (20:24 +0000)
commit3f1b0ce6bb4f2e7d44791c5532728f86e24f1f1f
treebdd8d968aeab4d158c10ad79a9194b8ac3ee5e75
parent68bd5121ee8954cfd7e3f7edb5d035f0e8b1bccc
cmd/compile/internal/types2: clarify is/underIs semantics and implementation

The behavior of is/underIs was murky with the presence of a top type term
(corresponding to a type set that is not constrained by any types, yet the
function argument f of is/underIs was called with that term).

Change is/underIs to call f explicitly for existing specific type terms,
otherwise return the result of f(nil). Review all uses of is/underIs and
variants.

This makes the conversion code slightly more complicated because we need
to explicitly exclude type parameters without specific types; but the
code is clearer now.

Change-Id: I6115cb46f7f2a8d0f54799aafff9a67c4cca5e30
Reviewed-on: https://go-review.googlesource.com/c/go/+/358594
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/builtins.go
src/cmd/compile/internal/types2/conversions.go
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/infer.go
src/cmd/compile/internal/types2/operand.go
src/cmd/compile/internal/types2/typeparam.go
src/cmd/compile/internal/types2/typeset.go