diff options
author | Dan Scales <danscales@google.com> | 2021-05-24 20:36:42 -0700 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-05-26 15:33:02 +0000 |
commit | fd54ae8b0c7ed3ef9869112586069f7cac82cf1e (patch) | |
tree | f328bab9546644f1ed7c6a947871850952e6f6d8 /src/cmd/compile/internal/types2/type.go | |
parent | 6c9e1c58bc7661638ee084e40a3b6fc907825496 (diff) | |
download | go-fd54ae8b0c7ed3ef9869112586069f7cac82cf1e.tar.gz go-fd54ae8b0c7ed3ef9869112586069f7cac82cf1e.zip |
[dev.typeparams] cmd/compile: adding union support in types1
Add union support in types1, and allow exporting of unions, and
importing unions back into types1 and types2.
Added new test mincheck.go/mincheck.dir that tests that type lists (type
sets) are correctly exported/imported, so that types2 gives correct
errors that an instantiation doesn't fit the type list in the type param
constraint.
Change-Id: I8041c6c79289c870a95ed5a1b10e4c1c16985b12
Reviewed-on: https://go-review.googlesource.com/c/go/+/322609
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/types2/type.go')
-rw-r--r-- | src/cmd/compile/internal/types2/type.go | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/cmd/compile/internal/types2/type.go b/src/cmd/compile/internal/types2/type.go index 79a8f3cd7f..2a93ca0388 100644 --- a/src/cmd/compile/internal/types2/type.go +++ b/src/cmd/compile/internal/types2/type.go @@ -368,9 +368,6 @@ func NewInterface(methods []*Func, embeddeds []*Named) *Interface { } // NewInterfaceType returns a new (incomplete) interface for the given methods and embedded types. -// Each embedded type must have an underlying type of interface type (this property is not -// verified for defined types, which may be in the process of being set up and which don't -// have a valid underlying type yet). // NewInterfaceType takes ownership of the provided methods and may modify their types by setting // missing receivers. To compute the method set of the interface, Complete must be called. func NewInterfaceType(methods []*Func, embeddeds []Type) *Interface { @@ -386,16 +383,6 @@ func NewInterfaceType(methods []*Func, embeddeds []Type) *Interface { } } - // All embedded types should be interfaces; however, defined types - // may not yet be fully resolved. Only verify that non-defined types - // are interfaces. This matches the behavior of the code before the - // fix for #25301 (issue #25596). - for _, t := range embeddeds { - if _, ok := t.(*Named); !ok && !IsInterface(t) { - panic("embedded type is not an interface") - } - } - // sort for API stability sortMethods(methods) sortTypes(embeddeds) |