cmd/compile: get rid of redundant Type helper functions

Replace Isfixedarray, Isslice, and Isinter with the IsArray, IsSlice,
and IsInterface methods added for SSA. Rewrite performed mechanically
using gofmt -w -r "Isfoo(t) -> t.IsFoo()".

Because the IsFoo methods panic when given a nil pointer, a handful of
call sites had to be modified to check for nil Type values. These
aren't strictly necessary, because nil Type values should only occur
in invalid Go source programs, so it would be okay if we panicked on
them and gave up type checking the rest of the package. However, there
are a couple regress tests that expect we continue, so add checks to
keep those tests passing. (See #15029.)

Passes toolstash -cmp.

Change-Id: I511c6ac4cfdf3f9cbdb3e52a5fa91b6d09d82f80
Reviewed-on: https://go-review.googlesource.com/21336
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go
index 54aa52a..ea963bb 100644
--- a/src/cmd/compile/internal/gc/walk.go
+++ b/src/cmd/compile/internal/gc/walk.go
@@ -544,7 +544,7 @@
 		if Isptr[t.Etype] {
 			t = t.Elem()
 		}
-		if Isfixedarray(t) {
+		if t.IsArray() {
 			safeexpr(n.Left, init)
 			Nodconst(n, n.Type, t.Bound)
 			n.Typecheck = 1
@@ -1004,18 +1004,18 @@
 
 		var ll []*Node
 		if isnilinter(n.Type) {
-			if !Isinter(n.Left.Type) {
+			if !n.Left.Type.IsInterface() {
 				ll = append(ll, typename(n.Left.Type))
 			}
 		} else {
-			if Isinter(n.Left.Type) {
+			if n.Left.Type.IsInterface() {
 				ll = append(ll, typename(n.Type))
 			} else {
 				ll = append(ll, itabname(n.Left.Type, n.Type))
 			}
 		}
 
-		if Isinter(n.Left.Type) {
+		if n.Left.Type.IsInterface() {
 			ll = append(ll, n.Left)
 		} else {
 			// regular types are passed by reference to avoid C vararg calls
@@ -1044,7 +1044,7 @@
 		}
 
 		fn := syslook(convFuncName(n.Left.Type, n.Type))
-		if !Isinter(n.Left.Type) {
+		if !n.Left.Type.IsInterface() {
 			fn = substArgTypes(fn, n.Left.Type, n.Left.Type, n.Type)
 		} else {
 			fn = substArgTypes(fn, n.Left.Type, n.Type)
@@ -1157,7 +1157,7 @@
 		if t != nil && Isptr[t.Etype] {
 			t = t.Elem()
 		}
-		if Isfixedarray(t) {
+		if t.IsArray() {
 			n.Bounded = bounded(r, t.Bound)
 			if Debug['m'] != 0 && n.Bounded && !Isconst(n.Right, CTINT) {
 				Warn("index bounds check elided")
@@ -1923,7 +1923,7 @@
 
 		t = n.Type
 		et = n.Type.Etype
-		if Isinter(n.Type) {
+		if n.Type.IsInterface() {
 			if isnilinter(n.Type) {
 				on = syslook("printeface")
 			} else {
@@ -1933,7 +1933,7 @@
 		} else if Isptr[et] || et == TCHAN || et == TMAP || et == TFUNC || et == TUNSAFEPTR {
 			on = syslook("printpointer")
 			on = substArgTypes(on, n.Type) // any-1
-		} else if Isslice(n.Type) {
+		} else if n.Type.IsSlice() {
 			on = syslook("printslice")
 			on = substArgTypes(on, n.Type) // any-1
 		} else if Isint[et] {
@@ -2252,7 +2252,7 @@
 				continue
 			}
 
-			if l.Op == OINDEX && Isfixedarray(l.Left.Type) {
+			if l.Op == OINDEX && l.Left.Type.IsArray() {
 				l.Right = reorder3save(l.Right, all, i, &early)
 				l = l.Left
 				continue
@@ -2317,7 +2317,7 @@
 			continue
 		}
 
-		if n.Op == OINDEX && Isfixedarray(n.Left.Type) {
+		if n.Op == OINDEX && n.Left.Type != nil && n.Left.Type.IsArray() {
 			n = n.Left
 			continue
 		}
@@ -3047,10 +3047,10 @@
 	var l *Node
 
 	var r *Node
-	if Isinter(n.Left.Type) && !Isinter(n.Right.Type) {
+	if n.Left.Type.IsInterface() && !n.Right.Type.IsInterface() {
 		l = n.Left
 		r = n.Right
-	} else if !Isinter(n.Left.Type) && Isinter(n.Right.Type) {
+	} else if !n.Left.Type.IsInterface() && n.Right.Type.IsInterface() {
 		l = n.Right
 		r = n.Left
 	}
@@ -3097,7 +3097,7 @@
 		return n
 
 	case TARRAY:
-		if Isslice(t) {
+		if t.IsSlice() {
 			return n
 		}