Follow-up on https://go.dev/cl/519435.
Change-Id: I8febf5544f28acb87607331ff8be8454470328ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/519436
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
// x != y if we get here
assert(x != y)
- // Type elements (array, slice, etc. elements) use emode for unification.
- // Element types must match exactly if the types are used in an assignment.
- emode := mode
- if mode&assign != 0 {
- emode |= exact
- }
-
// If we don't require exact unification and both types are interfaces,
// one interface must have a subset of the methods of the other and
// corresponding method signatures must unify.
x, y = y, x
}
+ // Type elements (array, slice, etc. elements) use emode for unification.
+ // Element types must match exactly if the types are used in an assignment.
+ emode := mode
+ if mode&assign != 0 {
+ emode |= exact
+ }
+
switch x := x.(type) {
case *Basic:
// Basic types are singletons except for the rune and byte
// x != y if we get here
assert(x != y)
- // Type elements (array, slice, etc. elements) use emode for unification.
- // Element types must match exactly if the types are used in an assignment.
- emode := mode
- if mode&assign != 0 {
- emode |= exact
- }
-
// If we don't require exact unification and both types are interfaces,
// one interface must have a subset of the methods of the other and
// corresponding method signatures must unify.
x, y = y, x
}
+ // Type elements (array, slice, etc. elements) use emode for unification.
+ // Element types must match exactly if the types are used in an assignment.
+ emode := mode
+ if mode&assign != 0 {
+ emode |= exact
+ }
+
switch x := x.(type) {
case *Basic:
// Basic types are singletons except for the rune and byte