cue: define BottomKind as 0

This simplifies APIs and confusion.

Change-Id: I0d780c2041e36d5b91fb361f1f2a06a071e7c36e
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2955
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/types.go b/cue/types.go
index 6ca8760..e71ab71 100644
--- a/cue/types.go
+++ b/cue/types.go
@@ -35,12 +35,11 @@
 // Kind determines the underlying type of a Value.
 type Kind int
 
-const (
-	// BottomKind is the error value.
-	BottomKind Kind = 1 << iota
+const BottomKind Kind = 0
 
+const (
 	// NullKind indicates a null value.
-	NullKind
+	NullKind Kind = 1 << iota
 
 	// BoolKind indicates a boolean value.
 	BoolKind
diff --git a/cue/types_test.go b/cue/types_test.go
index 764228a..ca16b49 100644
--- a/cue/types_test.go
+++ b/cue/types_test.go
@@ -194,10 +194,6 @@
 			if got := v.IncompleteKind(); got != want {
 				t.Errorf("IncompleteKind: got %x; want %x", got, want)
 			}
-			incomplete := tc.incompleteKind != tc.kind
-			if got := v.IsIncomplete(); got != incomplete {
-				t.Errorf("IsIncomplete: got %v; want %v", got, incomplete)
-			}
 			if got := v.IsConcrete(); got != tc.concrete {
 				t.Errorf("IsConcrete: got %v; want %v", got, tc.concrete)
 			}
@@ -772,7 +768,7 @@
 		// 	length: "2",
 	}, {
 		input:  "3",
-		length: "_|_(len not supported for type 8)", // TODO: fix kind name
+		length: "_|_(len not supported for type 4)", // TODO: fix kind name
 	}}
 	for _, tc := range testCases {
 		t.Run(tc.input, func(t *testing.T) {
diff --git a/encoding/openapi/build.go b/encoding/openapi/build.go
index 8d690d1..5fee0a5 100644
--- a/encoding/openapi/build.go
+++ b/encoding/openapi/build.go
@@ -498,7 +498,7 @@
 		return
 	}
 
-	switch v.IncompleteKind() &^ cue.BottomKind {
+	switch v.IncompleteKind() {
 	case cue.BoolKind:
 		b.typ = "boolean"
 	case cue.FloatKind, cue.NumberKind:
@@ -522,7 +522,7 @@
 		return
 	}
 
-	switch v.IncompleteKind() &^ cue.BottomKind {
+	switch v.IncompleteKind() {
 	case cue.NullKind:
 		// TODO: for JSON schema we would set the type here. For OpenAPI,
 		// it must be nullable.
diff --git a/encoding/openapi/crd.go b/encoding/openapi/crd.go
index 28b935f..a6ed8a3 100644
--- a/encoding/openapi/crd.go
+++ b/encoding/openapi/crd.go
@@ -116,7 +116,7 @@
 		b.format = format
 	} else {
 		v = v.Eval()
-		b.kind = v.IncompleteKind() &^ cue.BottomKind
+		b.kind = v.IncompleteKind()
 
 		switch b.kind {
 		case cue.StructKind:
diff --git a/pkg/tool/file/file.go b/pkg/tool/file/file.go
index b64a64d..694f832 100644
--- a/pkg/tool/file/file.go
+++ b/pkg/tool/file/file.go
@@ -54,7 +54,7 @@
 	}
 	update := map[string]interface{}{"contents": b}
 
-	switch v.Lookup("contents").IncompleteKind() &^ cue.BottomKind {
+	switch v.Lookup("contents").IncompleteKind() {
 	case cue.BytesKind:
 	case cue.StringKind:
 		update["contents"] = string(b)