cue: do not evaluate list elem for evalPartial

This essentially treats it like a field, instead of part
of the list itself.

This improves output for OpenAPI generation.

Change-Id: Ic3002005ab9142e6de98968f777c4f8410778015
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/5401
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/binop.go b/cue/binop.go
index a19c24b..b7ec258 100644
--- a/cue/binop.go
+++ b/cue/binop.go
@@ -1188,13 +1188,7 @@
 		typ := x.typ
 		max, ok := n.(*numLit)
 		if !ok || len(xa) < max.intValue(ctx) {
-			src := mkBin(ctx, src.Pos(), op, x.typ, y.typ)
-			xt := x.typ.evalPartial(ctx)
-			yt := y.typ.evalPartial(ctx)
-			typ = binOp(ctx, src, op, xt, yt)
-			if isBottom(typ) {
-				return ctx.mkErr(src, "conflicting list element types: %v", typ)
-			}
+			typ = mkBin(ctx, src.Pos(), op, x.typ, y.typ)
 		}
 
 		// TODO: use forwarding instead of this mild hack.
diff --git a/cue/resolve_test.go b/cue/resolve_test.go
index 2e21e1b..f8c8857 100644
--- a/cue/resolve_test.go
+++ b/cue/resolve_test.go
@@ -954,7 +954,7 @@
 			`t0: [<3>{a: 8}], ` +
 			`t1: [, ...int], ` +
 			`e0: _|_(([<4>{},<4>{}] & [<5>{}]):conflicting list lengths: conflicting values 2 and 1), ` +
-			`e1: _|_((int & float):conflicting list element types: conflicting values int and float (mismatched types int and float))` +
+			`e1: [, ..._|_((int & float):conflicting values int and float (mismatched types int and float))]` +
 			`}`,
 	}, {
 		// TODO: consider removing list arithmetic altogether. It is no longer
diff --git a/encoding/openapi/testdata/array.json b/encoding/openapi/testdata/array.json
index 2cf335a..0f7f9fe 100644
--- a/encoding/openapi/testdata/array.json
+++ b/encoding/openapi/testdata/array.json
@@ -50,13 +50,7 @@
                "e": {
                   "type": "array",
                   "items": {
-                     "type": "string",
-                     "enum": [
-                        "1",
-                        "2",
-                        "3"
-                     ],
-                     "default": "1"
+                     "$ref": "#/components/schemas/MyEnum"
                   }
                }
             }