cue: remove error type aliases

these were left over from a refactoring

Change-Id: Ibeb934c79fdee708bc74729fc597dce274c2ca60
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9345
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/errors.go b/cue/errors.go
index 3ce30f0..9f3cacb 100644
--- a/cue/errors.go
+++ b/cue/errors.go
@@ -89,25 +89,18 @@
 	return e.v.appendPath(nil)
 }
 
-type errCode = adt.ErrorCode
-
-const (
-	codeNotExist   = adt.NotExistError
-	codeIncomplete = adt.IncompleteError
-)
-
 var errNotExists = &adt.Bottom{
-	Code: codeNotExist,
+	Code: adt.NotExistError,
 	Err:  errors.Newf(token.NoPos, "undefined value"),
 }
 
 func (idx *index) mkErr(src adt.Node, args ...interface{}) *adt.Bottom {
 	var e *adt.Bottom
-	var code errCode = -1
+	var code adt.ErrorCode = -1
 outer:
 	for i, a := range args {
 		switch x := a.(type) {
-		case errCode:
+		case adt.ErrorCode:
 			code = x
 		case *adt.Bottom:
 			e = adt.CombineErrors(nil, e, x)
diff --git a/cue/query.go b/cue/query.go
index 43978c3..3cef7c2 100644
--- a/cue/query.go
+++ b/cue/query.go
@@ -72,7 +72,7 @@
 			x = &adt.Bottom{Err: err.Error}
 		} else {
 			// TODO: better message.
-			x = v.idx.mkErr(n, codeNotExist, "value %q not found", sel.sel)
+			x = v.idx.mkErr(n, adt.NotExistError, "value %q not found", sel.sel)
 		}
 		v := makeValue(v.idx, n)
 		return newErrValue(v, x)
diff --git a/cue/types.go b/cue/types.go
index b8ec62a..dbe5f4f 100644
--- a/cue/types.go
+++ b/cue/types.go
@@ -136,7 +136,7 @@
 	if i == len {
 		// TODO: better message.
 		ctx := o.ctx
-		x := ctx.mkErr(o.obj, codeNotExist, "value %q not found", key)
+		x := ctx.mkErr(o.obj, adt.NotExistError, "value %q not found", key)
 		return newErrValue(o.v, x)
 	}
 	return newChildValue(o, i)
@@ -179,7 +179,7 @@
 	return &marshalError{v.toErr(b), b}
 }
 
-func marshalErrf(v Value, src adt.Node, code errCode, msg string, args ...interface{}) error {
+func marshalErrf(v Value, src adt.Node, code adt.ErrorCode, msg string, args ...interface{}) error {
 	arguments := append([]interface{}{code, msg}, args...)
 	b := v.idx.mkErr(src, arguments...)
 	return toMarshalErr(v, b)
@@ -880,10 +880,10 @@
 	x := v.eval(ctx)
 
 	if _, ok := x.(adt.Resolver); ok {
-		return nil, marshalErrf(v, x, codeIncomplete, "value %q contains unresolved references", ctx.str(x))
+		return nil, marshalErrf(v, x, adt.IncompleteError, "value %q contains unresolved references", ctx.str(x))
 	}
 	if !adt.IsConcrete(x) {
-		return nil, marshalErrf(v, x, codeIncomplete, "cannot convert incomplete value %q to JSON", ctx.str(x))
+		return nil, marshalErrf(v, x, adt.IncompleteError, "cannot convert incomplete value %q to JSON", ctx.str(x))
 	}
 
 	// TODO: implement marshalles in value.
@@ -1139,7 +1139,7 @@
 		return false
 	}
 	if err, ok := v.v.BaseValue.(*adt.Bottom); ok {
-		return err.Code != codeNotExist
+		return err.Code != adt.NotExistError
 	}
 	return true
 }
@@ -1160,7 +1160,7 @@
 				ctx.opCtx.Str(x), k, want)
 		}
 		if !adt.IsConcrete(x) {
-			return ctx.mkErr(x, codeIncomplete, "non-concrete value %v", k)
+			return ctx.mkErr(x, adt.IncompleteError, "non-concrete value %v", k)
 		}
 	}
 	return nil