go/types, types2: simplify Default function

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>
diff --git a/src/cmd/compile/internal/types2/predicates.go b/src/cmd/compile/internal/types2/predicates.go
index 6d9e6ec..986cd6a 100644
--- a/src/cmd/compile/internal/types2/predicates.go
+++ b/src/cmd/compile/internal/types2/predicates.go
@@ -518,7 +518,9 @@
 // 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 1889694..83bc647 100644
--- a/src/go/types/predicates.go
+++ b/src/go/types/predicates.go
@@ -521,7 +521,9 @@
 // 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]