diff options
author | Robert Griesemer <gri@golang.org> | 2024-04-25 08:57:36 -0700 |
---|---|---|
committer | Robert Griesemer <gri@google.com> | 2024-04-25 17:07:36 +0000 |
commit | 06478e4b4659966e4f5dba1f399da9767995fee5 (patch) | |
tree | 65020c355dca46c57192eff99ca77be4d55605cf | |
parent | 8c0da423f77fff5e206ad777cfc496e935cb3af6 (diff) | |
download | go-master.tar.gz go-master.zip |
Change-Id: Ie2b7c1324ec7947c6ff43187dda99b83bcb64f08
Reviewed-on: https://go-review.googlesource.com/c/go/+/581775
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
-rw-r--r-- | src/cmd/compile/internal/types2/predicates.go | 4 | ||||
-rw-r--r-- | src/go/types/predicates.go | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/types2/predicates.go b/src/cmd/compile/internal/types2/predicates.go index 6d9e6ec760..986cd6aa61 100644 --- a/src/cmd/compile/internal/types2/predicates.go +++ b/src/cmd/compile/internal/types2/predicates.go @@ -518,7 +518,9 @@ func identicalInstance(xorig Type, xargs []Type, yorig Type, yargs []Type) bool // it returns the incoming type for all other types. The default type // for untyped nil is untyped nil. func Default(t Type) Type { - if t, ok := Unalias(t).(*Basic); ok { + // Alias and named types cannot denote untyped types + // so there's no need to call Unalias or under, below. + if t, _ := t.(*Basic); t != nil { switch t.kind { case UntypedBool: return Typ[Bool] diff --git a/src/go/types/predicates.go b/src/go/types/predicates.go index 1889694342..83bc64772f 100644 --- a/src/go/types/predicates.go +++ b/src/go/types/predicates.go @@ -521,7 +521,9 @@ func identicalInstance(xorig Type, xargs []Type, yorig Type, yargs []Type) bool // it returns the incoming type for all other types. The default type // for untyped nil is untyped nil. func Default(t Type) Type { - if t, ok := Unalias(t).(*Basic); ok { + // Alias and named types cannot denote untyped types + // so there's no need to call Unalias or under, below. + if t, _ := t.(*Basic); t != nil { switch t.kind { case UntypedBool: return Typ[Bool] |