internal/core/eval: use cue's import support in tests

Change-Id: I52e179479f99402bc0ec28c09614a3c80de79b17
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6520
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/testdata/basicrewrite/001_regexp.txtar b/cue/testdata/basicrewrite/001_regexp.txtar
index b11bdeb..99b3e0f 100644
--- a/cue/testdata/basicrewrite/001_regexp.txtar
+++ b/cue/testdata/basicrewrite/001_regexp.txtar
@@ -62,11 +62,11 @@
 }
 -- out/eval --
 Errors:
-invalid value *adt.BoundValue (mismatched types number and string)
-invalid value *adt.Vertex (out of bound *adt.BoundValue)
-cannot use *adt.Num (type int) as type (string|bytes):
+invalid value "foo" (out of bound =~"[a-z]{4}")
+invalid value <5 (mismatched types number and string)
+cannot use 1 (type int) as type (string|bytes):
     ./in.cue:18:5
-cannot use *adt.Bool (type bool) as type (string|bytes):
+cannot use true (type bool) as type (string|bytes):
     ./in.cue:19:5
 
 Result:
@@ -79,20 +79,20 @@
   b1: (string){ "a" }
   b2: (string){ "foo" }
   b3: (_|_){
-    // [eval] invalid value *adt.Vertex (out of bound *adt.BoundValue)
+    // [eval] invalid value "foo" (out of bound =~"[a-z]{4}")
   }
   b4: (string){ "foo" }
   s1: (string){ &(!="b", =~"c") }
   s2: (string){ &(!="b", =~"[a-z]") }
   e1: (_|_){
-    // [eval] cannot use *adt.Num (type int) as type (string|bytes):
+    // [eval] cannot use 1 (type int) as type (string|bytes):
     //     ./in.cue:18:5
   }
   e2: (_|_){
-    // [eval] cannot use *adt.Bool (type bool) as type (string|bytes):
+    // [eval] cannot use true (type bool) as type (string|bytes):
     //     ./in.cue:19:5
   }
   e3: (_|_){
-    // [eval] invalid value *adt.BoundValue (mismatched types number and string)
+    // [eval] invalid value <5 (mismatched types number and string)
   }
 }
diff --git a/cue/testdata/basicrewrite/002_arithmetic.txtar b/cue/testdata/basicrewrite/002_arithmetic.txtar
index 2f4292a..b2f1914 100644
--- a/cue/testdata/basicrewrite/002_arithmetic.txtar
+++ b/cue/testdata/basicrewrite/002_arithmetic.txtar
@@ -107,15 +107,15 @@
     ./in.cue:15:9
 division by zero:
     ./in.cue:16:9
-invalid operands *adt.Num and *adt.String to '+' (type int and string):
+invalid operands 2 and "a" to '+' (type int and string):
     ./in.cue:23:5
-invalid operands *adt.Num and *adt.Num to 'div' (type float and int):
+invalid operands 1.0 and 2 to 'div' (type float and int):
     ./in.cue:29:5
-invalid operands *adt.Num and *adt.Num to 'rem' (type int and float):
+invalid operands 2 and 2.0 to 'rem' (type int and float):
     ./in.cue:30:5
-invalid operands *adt.Num and *adt.Num to 'quo' (type int and float):
+invalid operands 2 and 2.0 to 'quo' (type int and float):
     ./in.cue:31:5
-invalid operands *adt.Num and *adt.Num to 'mod' (type float and int):
+invalid operands 1.0 and 1 to 'mod' (type float and int):
     ./in.cue:32:5
 
 Result:
@@ -158,23 +158,23 @@
   v3: (float){ 0.666666666666666666666667 }
   v5: (int){ 0 }
   e0: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.String to '+' (type int and string):
+    // [eval] invalid operands 2 and "a" to '+' (type int and string):
     //     ./in.cue:23:5
   }
   e5: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.Num to 'div' (type float and int):
+    // [eval] invalid operands 1.0 and 2 to 'div' (type float and int):
     //     ./in.cue:29:5
   }
   e6: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.Num to 'rem' (type int and float):
+    // [eval] invalid operands 2 and 2.0 to 'rem' (type int and float):
     //     ./in.cue:30:5
   }
   e7: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.Num to 'quo' (type int and float):
+    // [eval] invalid operands 2 and 2.0 to 'quo' (type int and float):
     //     ./in.cue:31:5
   }
   e8: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.Num to 'mod' (type float and int):
+    // [eval] invalid operands 1.0 and 1 to 'mod' (type float and int):
     //     ./in.cue:32:5
   }
 }
diff --git a/cue/testdata/basicrewrite/003_integer-specific_arithmetic.txtar b/cue/testdata/basicrewrite/003_integer-specific_arithmetic.txtar
index 0bfa968..f5f5245 100644
--- a/cue/testdata/basicrewrite/003_integer-specific_arithmetic.txtar
+++ b/cue/testdata/basicrewrite/003_integer-specific_arithmetic.txtar
@@ -87,21 +87,21 @@
 }
 -- out/eval --
 Errors:
-invalid operands *adt.Num and *adt.Num to 'quo' (type float and int):
+invalid operands 2.0 and 1 to 'quo' (type float and int):
     ./in.cue:5:6
-invalid operands *adt.Num and *adt.Num to 'quo' (type int and float):
+invalid operands 2 and 1.0 to 'quo' (type int and float):
     ./in.cue:6:6
-invalid operands *adt.Num and *adt.Num to 'rem' (type float and int):
+invalid operands 2.0 and 1 to 'rem' (type float and int):
     ./in.cue:12:6
-invalid operands *adt.Num and *adt.Num to 'rem' (type int and float):
+invalid operands 2 and 1.0 to 'rem' (type int and float):
     ./in.cue:13:6
-invalid operands *adt.Num and *adt.Num to 'div' (type float and int):
+invalid operands 2.0 and 1 to 'div' (type float and int):
     ./in.cue:19:6
-invalid operands *adt.Num and *adt.Num to 'div' (type int and float):
+invalid operands 2 and 1.0 to 'div' (type int and float):
     ./in.cue:20:6
-invalid operands *adt.Num and *adt.Num to 'mod' (type float and int):
+invalid operands 2.0 and 1 to 'mod' (type float and int):
     ./in.cue:26:6
-invalid operands *adt.Num and *adt.Num to 'mod' (type int and float):
+invalid operands 2 and 1.0 to 'mod' (type int and float):
     ./in.cue:27:6
 
 Result:
@@ -112,11 +112,11 @@
   q3: (int){ -2 }
   q4: (int){ 2 }
   qe1: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.Num to 'quo' (type float and int):
+    // [eval] invalid operands 2.0 and 1 to 'quo' (type float and int):
     //     ./in.cue:5:6
   }
   qe2: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.Num to 'quo' (type int and float):
+    // [eval] invalid operands 2 and 1.0 to 'quo' (type int and float):
     //     ./in.cue:6:6
   }
   r1: (int){ 1 }
@@ -124,11 +124,11 @@
   r3: (int){ -1 }
   r4: (int){ -1 }
   re1: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.Num to 'rem' (type float and int):
+    // [eval] invalid operands 2.0 and 1 to 'rem' (type float and int):
     //     ./in.cue:12:6
   }
   re2: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.Num to 'rem' (type int and float):
+    // [eval] invalid operands 2 and 1.0 to 'rem' (type int and float):
     //     ./in.cue:13:6
   }
   d1: (int){ 2 }
@@ -136,11 +136,11 @@
   d3: (int){ -3 }
   d4: (int){ 3 }
   de1: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.Num to 'div' (type float and int):
+    // [eval] invalid operands 2.0 and 1 to 'div' (type float and int):
     //     ./in.cue:19:6
   }
   de2: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.Num to 'div' (type int and float):
+    // [eval] invalid operands 2 and 1.0 to 'div' (type int and float):
     //     ./in.cue:20:6
   }
   m1: (int){ 1 }
@@ -148,11 +148,11 @@
   m3: (int){ 1 }
   m4: (int){ 1 }
   me1: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.Num to 'mod' (type float and int):
+    // [eval] invalid operands 2.0 and 1 to 'mod' (type float and int):
     //     ./in.cue:26:6
   }
   me2: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.Num to 'mod' (type int and float):
+    // [eval] invalid operands 2 and 1.0 to 'mod' (type int and float):
     //     ./in.cue:27:6
   }
 }
diff --git a/cue/testdata/basicrewrite/004_booleans.txtar b/cue/testdata/basicrewrite/004_booleans.txtar
index b97eda7..3fcd416 100644
--- a/cue/testdata/basicrewrite/004_booleans.txtar
+++ b/cue/testdata/basicrewrite/004_booleans.txtar
@@ -27,7 +27,7 @@
 }
 -- out/eval --
 Errors:
-incompatible values *adt.Bool and *adt.Bool
+incompatible values false and true
 
 Result:
 (_|_){
@@ -35,6 +35,6 @@
   t: (bool){ true }
   f: (bool){ false }
   e: (_|_){
-    // [eval] incompatible values *adt.Bool and *adt.Bool
+    // [eval] incompatible values false and true
   }
 }
diff --git a/cue/testdata/basicrewrite/005_boolean_arithmetic.txtar b/cue/testdata/basicrewrite/005_boolean_arithmetic.txtar
index 47c88d2..51ec726 100644
--- a/cue/testdata/basicrewrite/005_boolean_arithmetic.txtar
+++ b/cue/testdata/basicrewrite/005_boolean_arithmetic.txtar
@@ -30,7 +30,7 @@
 }
 -- out/eval --
 Errors:
-incompatible values *adt.Bool and *adt.Bool
+incompatible values false and true
 
 Result:
 (_|_){
@@ -41,6 +41,6 @@
   d: (bool){ true }
   e: (bool){ true }
   f: (_|_){
-    // [eval] incompatible values *adt.Bool and *adt.Bool
+    // [eval] incompatible values false and true
   }
 }
diff --git a/cue/testdata/basicrewrite/006_basic_type.txtar b/cue/testdata/basicrewrite/006_basic_type.txtar
index e1a7cf2..d352f6c 100644
--- a/cue/testdata/basicrewrite/006_basic_type.txtar
+++ b/cue/testdata/basicrewrite/006_basic_type.txtar
@@ -34,7 +34,7 @@
 }
 -- out/eval --
 Errors:
-invalid value *adt.BasicType (mismatched types float and int)
+invalid value float (mismatched types float and int)
 
 Result:
 (_|_){
@@ -43,7 +43,7 @@
   b: (int){ 1 }
   c: (float){ 1.0 }
   d: (_|_){
-    // [eval] invalid value *adt.BasicType (mismatched types float and int)
+    // [eval] invalid value float (mismatched types float and int)
   }
   e: (string){ "4" }
   f: (bool){ true }
diff --git a/cue/testdata/basicrewrite/007_strings_and_bytes.txtar b/cue/testdata/basicrewrite/007_strings_and_bytes.txtar
index 92fcb50..c416314 100644
--- a/cue/testdata/basicrewrite/007_strings_and_bytes.txtar
+++ b/cue/testdata/basicrewrite/007_strings_and_bytes.txtar
@@ -41,9 +41,9 @@
 }
 -- out/eval --
 Errors:
-invalid operands *adt.String and *adt.Bytes to '+' (type string and bytes):
+invalid operands "a" and '' to '+' (type string and bytes):
     ./in.cue:10:5
-invalid operands *adt.Bytes and *adt.String to '+' (type bytes and string):
+invalid operands 'b' and "c" to '+' (type bytes and string):
     ./in.cue:11:5
 
 Result:
@@ -56,11 +56,11 @@
   b1: (bytes){ 'abcabcabc' }
   b2: (bytes){ 'abcabc' }
   e0: (_|_){
-    // [eval] invalid operands *adt.String and *adt.Bytes to '+' (type string and bytes):
+    // [eval] invalid operands "a" and '' to '+' (type string and bytes):
     //     ./in.cue:10:5
   }
   e1: (_|_){
-    // [eval] invalid operands *adt.Bytes and *adt.String to '+' (type bytes and string):
+    // [eval] invalid operands 'b' and "c" to '+' (type bytes and string):
     //     ./in.cue:11:5
   }
 }
diff --git a/cue/testdata/basicrewrite/010_lists.txtar b/cue/testdata/basicrewrite/010_lists.txtar
index 9cb4fc8..9de56c6 100644
--- a/cue/testdata/basicrewrite/010_lists.txtar
+++ b/cue/testdata/basicrewrite/010_lists.txtar
@@ -77,10 +77,10 @@
 -- out/eval --
 Errors:
 conflicting types
-invalid value *adt.Num (out of bound *adt.BoundValue)
+invalid value 8 (out of bound <=5)
 invalid list index d (type string):
     ./in.cue:5:12
-invalid negative index *adt.Num:
+invalid negative index -1:
     ./in.cue:6:8
 
 Result:
@@ -105,7 +105,7 @@
     //     ./in.cue:5:12
   }
   e3: (_|_){
-    // [eval] invalid negative index *adt.Num:
+    // [eval] invalid negative index -1:
     //     ./in.cue:6:8
   }
   e4: (_|_){
@@ -114,7 +114,7 @@
     1: (int){ 2 }
     2: (int){ 4 }
     3: (_|_){
-      // [eval] invalid value *adt.Num (out of bound *adt.BoundValue)
+      // [eval] invalid value 8 (out of bound <=5)
     }
   }
   e5: (_|_){
@@ -123,7 +123,7 @@
     1: (int){ 2 }
     2: (int){ 4 }
     3: (_|_){
-      // [eval] invalid value *adt.Num (out of bound *adt.BoundValue)
+      // [eval] invalid value 8 (out of bound <=5)
     }
   }
 }
diff --git a/cue/testdata/basicrewrite/015_types.txtar b/cue/testdata/basicrewrite/015_types.txtar
index ae5fc31..ea817a0 100644
--- a/cue/testdata/basicrewrite/015_types.txtar
+++ b/cue/testdata/basicrewrite/015_types.txtar
@@ -39,12 +39,12 @@
 }
 -- out/eval --
 Errors:
-invalid value *adt.BasicType (mismatched types string and int)
+invalid value string (mismatched types string and int)
 value can never become concrete:
     ./in.cue:7:5
-invalid operation +*adt.UnaryExpr (+ bool):
+invalid operation ++true (+ bool):
     ./in.cue:8:5
-invalid operation -*adt.UnaryExpr (- bool):
+invalid operation --false (- bool):
     ./in.cue:9:5
 
 Result:
@@ -55,21 +55,21 @@
   s: (string){ string }
   t: (string){ "s" }
   e: (_|_){
-    // [eval] invalid value *adt.BasicType (mismatched types string and int)
+    // [eval] invalid value string (mismatched types string and int)
   }
   e2: (_|_){
-    // [eval] invalid value *adt.BasicType (mismatched types string and int)
+    // [eval] invalid value string (mismatched types string and int)
   }
   b: (_|_){
     // [eval] value can never become concrete:
     //     ./in.cue:7:5
   }
   p: (_|_){
-    // [eval] invalid operation +*adt.UnaryExpr (+ bool):
+    // [eval] invalid operation ++true (+ bool):
     //     ./in.cue:8:5
   }
   m: (_|_){
-    // [eval] invalid operation -*adt.UnaryExpr (- bool):
+    // [eval] invalid operation --false (- bool):
     //     ./in.cue:9:5
   }
 }
diff --git a/cue/testdata/basicrewrite/016_comparison.txtar b/cue/testdata/basicrewrite/016_comparison.txtar
index 84b04c7..6e204b1 100644
--- a/cue/testdata/basicrewrite/016_comparison.txtar
+++ b/cue/testdata/basicrewrite/016_comparison.txtar
@@ -38,7 +38,7 @@
 }
 -- out/eval --
 Errors:
-invalid operands *adt.Num and *adt.String to '==' (type int and string):
+invalid operands 2 and "s" to '==' (type int and string):
     ./in.cue:9:6
 
 Result:
@@ -52,7 +52,7 @@
   geq: (bool){ true }
   seq: (bool){ true }
   err: (_|_){
-    // [eval] invalid operands *adt.Num and *adt.String to '==' (type int and string):
+    // [eval] invalid operands 2 and "s" to '==' (type int and string):
     //     ./in.cue:9:6
   }
 }
diff --git a/cue/testdata/basicrewrite/017_null.txtar b/cue/testdata/basicrewrite/017_null.txtar
index 3fcd292..e04c50a 100644
--- a/cue/testdata/basicrewrite/017_null.txtar
+++ b/cue/testdata/basicrewrite/017_null.txtar
@@ -37,7 +37,7 @@
 }
 -- out/eval --
 Errors:
-cannot call non-function *adt.Null (type null):
+cannot call non-function null (type null):
     ./in.cue:9:7
 
 Result:
@@ -50,7 +50,7 @@
   eq2: (bool){ false }
   ne1: (bool){ true }
   call: (_|_){
-    // [eval] cannot call non-function *adt.Null (type null):
+    // [eval] cannot call non-function null (type null):
     //     ./in.cue:9:7
   }
 }
diff --git a/cue/testdata/builtins/list/sort.txtar b/cue/testdata/builtins/list/sort.txtar
new file mode 100644
index 0000000..238c78b
--- /dev/null
+++ b/cue/testdata/builtins/list/sort.txtar
@@ -0,0 +1,28 @@
+-- in.cue --
+import "list"
+
+a: list.Sort([2, 3, 1, 4], {x:_, y:_, less: x<y})
+
+-- out/eval --
+(struct){
+  a: (#list){
+    0: (int){ 1 }
+    1: (int){ 2 }
+    2: (int){ 3 }
+    3: (int){ 4 }
+  }
+}
+-- out/compile --
+--- in.cue
+{
+  a: 〈import;list〉.Sort([
+    2,
+    3,
+    1,
+    4,
+  ], {
+    x: _
+    y: _
+    less: (〈0;x〉 < 〈0;y〉)
+  })
+}
diff --git a/cue/testdata/cycle/021_delayed_constraint_failure.txtar b/cue/testdata/cycle/021_delayed_constraint_failure.txtar
index 1363cf5..9fb2ce2 100644
--- a/cue/testdata/cycle/021_delayed_constraint_failure.txtar
+++ b/cue/testdata/cycle/021_delayed_constraint_failure.txtar
@@ -26,16 +26,17 @@
 }
 -- out/eval --
 Errors:
-incompatible values *adt.Num and *adt.Num
+incompatible values 101 and 100
+incompatible values 200 and 210
 
 Result:
 (_|_){
   // [eval]
   a: (int){ 100 }
   b: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num
+    // [eval] incompatible values 200 and 210
   }
   x: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num
+    // [eval] incompatible values 101 and 100
   }
 }
diff --git a/cue/testdata/cycle/049_self-reference_cycles_conflicts_with_strings.txtar b/cue/testdata/cycle/049_self-reference_cycles_conflicts_with_strings.txtar
index 81993c8..8a13a29 100644
--- a/cue/testdata/cycle/049_self-reference_cycles_conflicts_with_strings.txtar
+++ b/cue/testdata/cycle/049_self-reference_cycles_conflicts_with_strings.txtar
@@ -28,7 +28,7 @@
 }
 -- out/eval --
 Errors:
-incompatible values *adt.String and *adt.String
+incompatible values "hey!?" and "hey"
 
 Result:
 (_|_){
@@ -36,10 +36,10 @@
   a: (_|_){
     // [eval]
     x: (_|_){
-      // [eval] incompatible values *adt.String and *adt.String
+      // [eval] incompatible values "hey!?" and "hey"
     }
     y: (_|_){
-      // [eval] incompatible values *adt.String and *adt.String
+      // [eval] incompatible values "hey!?" and "hey"
     }
   }
 }
diff --git a/cue/testdata/cycle/051_resolved_self-reference_cycles_with_disjunction.txtar b/cue/testdata/cycle/051_resolved_self-reference_cycles_with_disjunction.txtar
index c9e465e..1381f59 100644
--- a/cue/testdata/cycle/051_resolved_self-reference_cycles_with_disjunction.txtar
+++ b/cue/testdata/cycle/051_resolved_self-reference_cycles_with_disjunction.txtar
@@ -159,7 +159,7 @@
 }
 -- out/eval --
 Errors:
-incompatible values *adt.Num and *adt.Num:
+incompatible values 7 and 6:
     ./in.cue:44:6
 
 Result:
@@ -187,19 +187,19 @@
     // [incomplete] empty disjunction
   }
   xe2: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num:
+    // [eval] incompatible values 7 and 6:
     //     ./in.cue:44:6
   }
   xe3: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num:
+    // [eval] incompatible values 7 and 6:
     //     ./in.cue:44:6
   }
   xe4: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num:
+    // [eval] incompatible values 7 and 6:
     //     ./in.cue:44:6
   }
   xe5: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num:
+    // [eval] incompatible values 7 and 6:
     //     ./in.cue:44:6
   }
   xf1: (int){ 8 }
diff --git a/cue/testdata/cycle/052_resolved_self-reference_cycles_with_disjunction_with_defaults.txtar b/cue/testdata/cycle/052_resolved_self-reference_cycles_with_disjunction_with_defaults.txtar
index eccea37..8ff1abb 100644
--- a/cue/testdata/cycle/052_resolved_self-reference_cycles_with_disjunction_with_defaults.txtar
+++ b/cue/testdata/cycle/052_resolved_self-reference_cycles_with_disjunction_with_defaults.txtar
@@ -129,7 +129,7 @@
 }
 -- out/eval --
 Errors:
-incompatible values *adt.Num and *adt.Num:
+incompatible values 7 and 6:
     ./in.cue:37:6
 
 Result:
@@ -157,19 +157,19 @@
     // [incomplete] empty disjunction
   }
   xe2: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num:
+    // [eval] incompatible values 7 and 6:
     //     ./in.cue:37:6
   }
   xe3: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num:
+    // [eval] incompatible values 7 and 6:
     //     ./in.cue:37:6
   }
   xe4: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num:
+    // [eval] incompatible values 7 and 6:
     //     ./in.cue:37:6
   }
   xe5: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num:
+    // [eval] incompatible values 7 and 6:
     //     ./in.cue:37:6
   }
   z1: (int){ |(*(int){ 11 }, (int){ 13 }) }
diff --git a/cue/testdata/eval/disjunctions.txtar b/cue/testdata/eval/disjunctions.txtar
index 90e4f91..608a0f9 100644
--- a/cue/testdata/eval/disjunctions.txtar
+++ b/cue/testdata/eval/disjunctions.txtar
@@ -17,7 +17,7 @@
 
 -- out/eval --
 Errors:
-invalid value *adt.BasicType (mismatched types string and int)
+invalid value string (mismatched types string and int)
 
 Result:
 (_|_){
@@ -47,7 +47,7 @@
     // [eval]
     name: (string){ "str" }
     val: (_|_){
-      // [eval] invalid value *adt.BasicType (mismatched types string and int)
+      // [eval] invalid value string (mismatched types string and int)
     }
   }
 }
diff --git a/cue/testdata/eval/incomplete.txtar b/cue/testdata/eval/incomplete.txtar
index 62f637e..f302464 100644
--- a/cue/testdata/eval/incomplete.txtar
+++ b/cue/testdata/eval/incomplete.txtar
@@ -19,13 +19,13 @@
 (struct){
   s: (string){ string }
   e1: (_|_){
-    // [incomplete] non-concrete value *adt.BasicType in operand to +:
+    // [incomplete] non-concrete value string in operand to +:
     //     ./in.cue:3:5
   }
   e2: (string){ >"bar" }
   e3: (string){ "foo" }
   e4: (_|_){
-    // [incomplete] non-concrete value *adt.BasicType in operand to +:
+    // [incomplete] non-concrete value string in operand to +:
     //     ./in.cue:3:5
   }
   e5: (_|_){
diff --git a/cue/testdata/eval/resolve_basic.txtar b/cue/testdata/eval/resolve_basic.txtar
index 5b5f01b..9d04e0b 100644
--- a/cue/testdata/eval/resolve_basic.txtar
+++ b/cue/testdata/eval/resolve_basic.txtar
@@ -16,7 +16,7 @@
   d: (struct){
     x: (_){ _ }
     y: (_|_){
-      // [incomplete] non-concrete value *adt.BasicType in operand to +:
+      // [incomplete] non-concrete value _ in operand to +:
       //     ./in.cue:5:6
     }
   }
diff --git a/cue/testdata/eval/selectors.txtar b/cue/testdata/eval/selectors.txtar
index 5b5f01b..9d04e0b 100644
--- a/cue/testdata/eval/selectors.txtar
+++ b/cue/testdata/eval/selectors.txtar
@@ -16,7 +16,7 @@
   d: (struct){
     x: (_){ _ }
     y: (_|_){
-      // [incomplete] non-concrete value *adt.BasicType in operand to +:
+      // [incomplete] non-concrete value _ in operand to +:
       //     ./in.cue:5:6
     }
   }
diff --git a/cue/testdata/eval/structs.txtar b/cue/testdata/eval/structs.txtar
new file mode 100644
index 0000000..de12aa6
--- /dev/null
+++ b/cue/testdata/eval/structs.txtar
@@ -0,0 +1,17 @@
+-- in.cue --
+import "struct"
+
+v: {a: struct.MaxFields(2) & {}}.a
+
+-- out/eval --
+(struct){
+  v: (struct){
+  }
+}
+-- out/compile --
+--- in.cue
+{
+  v: {
+    a: (〈import;struct〉.MaxFields(2) & {})
+  }.a
+}
diff --git a/cue/testdata/export/008.txtar b/cue/testdata/export/008.txtar
index 6678e86..ee0c8c6 100644
--- a/cue/testdata/export/008.txtar
+++ b/cue/testdata/export/008.txtar
@@ -16,7 +16,7 @@
 }
 -- out/eval --
 Errors:
-incompatible values *adt.Num and *adt.Num
+incompatible values 4 and 3
 
 Result:
 (_|_){
@@ -24,7 +24,7 @@
   a: (_|_){
     // [eval]
     0: (_|_){
-      // [eval] incompatible values *adt.Num and *adt.Num
+      // [eval] incompatible values 4 and 3
     }
   }
 }
diff --git a/cue/testdata/export/012.txtar b/cue/testdata/export/012.txtar
index 6b2570f..55a79da 100644
--- a/cue/testdata/export/012.txtar
+++ b/cue/testdata/export/012.txtar
@@ -18,7 +18,7 @@
 (struct){
   a: ((int|string)){ |(*(string){ "foo" }, *(string){ "bar" }, *(string){ string }, (int){ int }) }
   b: (_|_){
-    // [incomplete] non-concrete slice subject *adt.FieldReference:
+    // [incomplete] non-concrete slice subject a:
     //     ./in.cue:1:41
   }
 }
diff --git a/cue/testdata/export/019.txtar b/cue/testdata/export/019.txtar
index b935b9e..bc1c2d8 100644
--- a/cue/testdata/export/019.txtar
+++ b/cue/testdata/export/019.txtar
@@ -16,7 +16,7 @@
 }
 -- out/eval --
 Errors:
-invalid interpolation: cannot use *adt.Conjunction (type number) as type string:
+invalid interpolation: cannot use >=0 & <=10 (type number) as type string:
     ./in.cue:1:20
 
 Result:
@@ -24,7 +24,7 @@
   // [eval]
   a: (number){ &(>=0, <=10) }
   b: (_|_){
-    // [eval] invalid interpolation: cannot use *adt.Conjunction (type number) as type string:
+    // [eval] invalid interpolation: cannot use >=0 & <=10 (type number) as type string:
     //     ./in.cue:1:20
   }
 }
diff --git a/cue/testdata/export/021.txtar b/cue/testdata/export/021.txtar
index 6618525..05d6c3e 100644
--- a/cue/testdata/export/021.txtar
+++ b/cue/testdata/export/021.txtar
@@ -46,7 +46,7 @@
 (struct){
   b: (struct){
     idx: (_|_){
-      // [incomplete] invalid non-ground value *adt.BasicType (must be concrete string)
+      // [incomplete] invalid non-ground value string (must be concrete string)
     }
     str: (string){ string }
     a: (struct){
diff --git a/cue/testdata/export/025.txtar b/cue/testdata/export/025.txtar
index b63886f..6bf3c9b 100644
--- a/cue/testdata/export/025.txtar
+++ b/cue/testdata/export/025.txtar
@@ -43,7 +43,7 @@
 -- out/eval --
 (struct){
   b: (_|_){
-    // [incomplete] invalid non-ground value *adt.BasicType (must be concrete int)
+    // [incomplete] invalid non-ground value int (must be concrete int)
   }
   a: (int){ int }
   c: (int){ |(*(int){ 1 }, (int){ 2 }) }
diff --git a/cue/testdata/fulleval/018_recursive_evaluation_within_list.txtar b/cue/testdata/fulleval/018_recursive_evaluation_within_list.txtar
index 4181a81..dbacf97 100644
--- a/cue/testdata/fulleval/018_recursive_evaluation_within_list.txtar
+++ b/cue/testdata/fulleval/018_recursive_evaluation_within_list.txtar
@@ -86,7 +86,7 @@
   }
   b1: (struct){
     d: (_|_){
-      // [incomplete] non-concrete value *adt.BasicType in operand to +:
+      // [incomplete] non-concrete value string in operand to +:
       //     ./in.cue:10:5
     }
     c: (string){ string }
diff --git a/cue/testdata/fulleval/020_complex_interaction_of_groundness.txtar b/cue/testdata/fulleval/020_complex_interaction_of_groundness.txtar
index 228da48..dadb8f8 100644
--- a/cue/testdata/fulleval/020_complex_interaction_of_groundness.txtar
+++ b/cue/testdata/fulleval/020_complex_interaction_of_groundness.txtar
@@ -72,7 +72,7 @@
       c: (struct){
         d: (string){ string }
         s: (_|_){
-          // [incomplete] non-concrete value *adt.BasicType in operand to +:
+          // [incomplete] non-concrete value string in operand to +:
           //     ./in.cue:4:34
         }
       }
diff --git a/cue/testdata/fulleval/021_complex_groundness_2.txtar b/cue/testdata/fulleval/021_complex_groundness_2.txtar
index fc9cdeb..c332769 100644
--- a/cue/testdata/fulleval/021_complex_groundness_2.txtar
+++ b/cue/testdata/fulleval/021_complex_groundness_2.txtar
@@ -83,9 +83,9 @@
     res: (struct){
       d: (string){ string }
       s: (_|_){
-        // [incomplete] non-concrete value *adt.BasicType in operand to +:
+        // [incomplete] non-concrete value string in operand to +:
         //     ./in.cue:5:25
-        // non-concrete value *adt.BasicType in operand to +:
+        // non-concrete value string in operand to +:
         //     ./in.cue:6:34
       }
     }
@@ -95,9 +95,9 @@
       c: (struct){
         d: (string){ string }
         s: (_|_){
-          // [incomplete] non-concrete value *adt.BasicType in operand to +:
+          // [incomplete] non-concrete value string in operand to +:
           //     ./in.cue:5:25
-          // non-concrete value *adt.BasicType in operand to +:
+          // non-concrete value string in operand to +:
           //     ./in.cue:6:34
         }
       }
diff --git "a/cue/testdata/fulleval/024_Issue_\04323.txtar" "b/cue/testdata/fulleval/024_Issue_\04323.txtar"
index bf2d4a9..a2da8e2 100644
--- "a/cue/testdata/fulleval/024_Issue_\04323.txtar"
+++ "b/cue/testdata/fulleval/024_Issue_\04323.txtar"
@@ -28,7 +28,7 @@
 }
 -- out/eval --
 Errors:
-incompatible values *adt.Num and *adt.Num
+incompatible values 2 and 3
 
 Result:
 (_|_){
@@ -41,7 +41,7 @@
   y: (_|_){
     // [eval]
     a: (_|_){
-      // [eval] incompatible values *adt.Num and *adt.Num
+      // [eval] incompatible values 2 and 3
     }
   }
 }
diff --git a/cue/testdata/fulleval/026_dont_convert_incomplete_errors_to_non-incomplete.txtar b/cue/testdata/fulleval/026_dont_convert_incomplete_errors_to_non-incomplete.txtar
index d41909a..b6e88bd 100644
--- a/cue/testdata/fulleval/026_dont_convert_incomplete_errors_to_non-incomplete.txtar
+++ b/cue/testdata/fulleval/026_dont_convert_incomplete_errors_to_non-incomplete.txtar
@@ -55,44 +55,40 @@
     }
   }
   n2: (_|_){
-    // [incomplete] operand *adt.UnaryExpr of '-' not concrete (was number):
+    // [incomplete] operand -num of '-' not concrete (was number):
     //     ./in.cue:4:6
   }
   n3: (_|_){
-    // [incomplete] operand *adt.UnaryExpr of '+' not concrete (was number):
+    // [incomplete] operand +num of '+' not concrete (was number):
     //     ./in.cue:5:6
   }
   n4: (_|_){
-    // [incomplete] non-concrete value *adt.BoundValue in operand to +:
+    // [incomplete] non-concrete value <4 in operand to +:
     //     ./in.cue:6:5
   }
   n5: (_|_){
-    // [incomplete] non-concrete value *adt.BoundValue in operand to -:
+    // [incomplete] non-concrete value <4 in operand to -:
     //     ./in.cue:7:5
   }
   n6: (_|_){
-    // [incomplete] non-concrete value *adt.BoundValue in operand to *:
+    // [incomplete] non-concrete value <4 in operand to *:
     //     ./in.cue:8:5
   }
   n7: (_|_){
-    // [incomplete] non-concrete value *adt.BoundValue in operand to /:
+    // [incomplete] non-concrete value <4 in operand to /:
     //     ./in.cue:9:5
   }
   b1: (_|_){
-    // [incomplete] operand *adt.UnaryExpr of '!' not concrete (was bool):
+    // [incomplete] operand !is of '!' not concrete (was bool):
     //     ./in.cue:11:6
   }
   s1: (_|_){
-    // [incomplete] invalid interpolation: incomplete string value '*adt.BasicType':
+    // [incomplete] invalid interpolation: incomplete string value 'string':
     //     ./in.cue:13:5
   }
-  s2: (_|_){
-    // [incomplete] incomplete value *adt.ImportReference:
-    //     ./in.cue:14:5
-  }
+  s2: (string){ strings.ContainsAny("dd") }
   s3: (_|_){
-    // [incomplete] incomplete value *adt.ImportReference:
-    //     ./in.cue:15:5
+    // [incomplete] error in call to strings.ContainsAny: non-concrete value string
   }
   str: (string){ string }
   num: (number){ <4 }
diff --git a/cue/testdata/fulleval/027_len_of_incomplete_types.txtar b/cue/testdata/fulleval/027_len_of_incomplete_types.txtar
index bc9111c..d76583f 100644
--- a/cue/testdata/fulleval/027_len_of_incomplete_types.txtar
+++ b/cue/testdata/fulleval/027_len_of_incomplete_types.txtar
@@ -41,16 +41,16 @@
   v3: (int){ 0 }
   v4: (int){ 1 }
   v5: (_|_){
-    // [incomplete] unresolved disjunction *adt.Disjunction (type struct):
+    // [incomplete] unresolved disjunction {a:3} | {a:4} (type struct):
     //     ./in.cue:6:7
   }
   v6: (_|_){
-    // [incomplete] unresolved disjunction *adt.Disjunction (type bytes):
+    // [incomplete] unresolved disjunction 'sf' | 'dd' (type bytes):
     //     ./in.cue:7:7
   }
   v7: (int){ 2 }
   v8: (_|_){
-    // [incomplete] unresolved disjunction *adt.Disjunction (type list):
+    // [incomplete] unresolved disjunction [2] | [1,2] (type list):
     //     ./in.cue:9:7
   }
   v9: (int){ 4 }
diff --git a/cue/testdata/fulleval/031_comparison_against_bottom.txtar b/cue/testdata/fulleval/031_comparison_against_bottom.txtar
index 1bd8227..14db904 100644
--- a/cue/testdata/fulleval/031_comparison_against_bottom.txtar
+++ b/cue/testdata/fulleval/031_comparison_against_bottom.txtar
@@ -61,7 +61,7 @@
 }
 -- out/eval --
 Errors:
-incompatible values *adt.Num and *adt.Num:
+incompatible values 2 and 1:
     ./in.cue:2:4
 
 Result:
@@ -69,13 +69,13 @@
   // [eval]
   a: (bool){ true }
   b: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num:
+    // [eval] incompatible values 2 and 1:
     //     ./in.cue:2:4
   }
   c: (bool){ true }
   d: (bool){ false }
   e: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num:
+    // [eval] incompatible values 2 and 1:
     //     ./in.cue:2:4
   }
   f: (bool){ true }
@@ -83,7 +83,7 @@
   h: (bool){ true }
   i: (bool){ false }
   err: (_|_){
-    // [eval] incompatible values *adt.Num and *adt.Num:
+    // [eval] incompatible values 2 and 1:
     //     ./in.cue:2:4
   }
 }
diff --git a/cue/testdata/fulleval/035_optionals_with_label_filters.txtar b/cue/testdata/fulleval/035_optionals_with_label_filters.txtar
index 004895c..a26c0b3 100644
--- a/cue/testdata/fulleval/035_optionals_with_label_filters.txtar
+++ b/cue/testdata/fulleval/035_optionals_with_label_filters.txtar
@@ -105,7 +105,7 @@
 field `cmd` not allowed
 field `foo1` not allowed
 field `fooTest1` not allowed
-invalid value *adt.Vertex (out of bound *adt.BoundValue)
+invalid value "badName" (out of bound =~"^test")
 
 Result:
 (_|_){
@@ -132,7 +132,7 @@
     fooTest: (_|_){
       // [eval]
       name: (_|_){
-        // [eval] invalid value *adt.Vertex (out of bound *adt.BoundValue)
+        // [eval] invalid value "badName" (out of bound =~"^test")
       }
       cmd: (string){ string }
     }
diff --git "a/cue/testdata/fulleval/044_Issue_\043178.txtar" "b/cue/testdata/fulleval/044_Issue_\043178.txtar"
index 4ad3745..6738257 100644
--- "a/cue/testdata/fulleval/044_Issue_\043178.txtar"
+++ "b/cue/testdata/fulleval/044_Issue_\043178.txtar"
@@ -27,13 +27,11 @@
 -- out/eval --
 (struct){
   foo: (_|_){
-    // [incomplete] incomplete value *adt.ImportReference:
-    //     ./in.cue:5:7
+    // [incomplete] error in call to encoding/csv.Decode: non-concrete value bytes
   }
   data: (bytes){ bytes }
   len: (int){ int }
   bar: (_|_){
-    // [incomplete] incomplete value *adt.ImportReference:
-    //     ./in.cue:9:6
+    // [incomplete] error in call to encoding/hex.EncodedLen: non-concrete value int
   }
 }
diff --git a/cue/testdata/fulleval/048_dont_pass_incomplete_values_to_builtins.txtar b/cue/testdata/fulleval/048_dont_pass_incomplete_values_to_builtins.txtar
index a180d34..4b58c30 100644
--- a/cue/testdata/fulleval/048_dont_pass_incomplete_values_to_builtins.txtar
+++ b/cue/testdata/fulleval/048_dont_pass_incomplete_values_to_builtins.txtar
@@ -14,3 +14,10 @@
 foo:   json.Marshal(input)
 -- out/legacy-debug --
 <0>{input: string, foo: <1>.Marshal (<2>.input)}
+-- out/eval --
+(struct){
+  input: (string){ string }
+  foo: (_|_){
+    // [incomplete] non-concrete argument 0
+  }
+}
diff --git a/cue/testdata/fulleval/050_json_Marshaling_detects_incomplete.txtar b/cue/testdata/fulleval/050_json_Marshaling_detects_incomplete.txtar
index dff8a179..0c5f6a0 100644
--- a/cue/testdata/fulleval/050_json_Marshaling_detects_incomplete.txtar
+++ b/cue/testdata/fulleval/050_json_Marshaling_detects_incomplete.txtar
@@ -22,3 +22,20 @@
 b: json.Marshal(foo)
 -- out/legacy-debug --
 <0>{a: <1>.Marshal (<2>{a: string}), foo: <3>{a: 3, b: <4>.foo.c}, b: <1>.Marshal (<4>.foo)}
+-- out/eval --
+(struct){
+  a: (_|_){
+    // [incomplete] cannot convert incomplete value "string" to JSON
+  }
+  foo: (struct){
+    a: (int){ 3 }
+    b: (_|_){
+      // [incomplete] undefined field c:
+      //     ./in.cue:5:20
+    }
+  }
+  b: (_|_){
+    // [incomplete] undefined field c:
+    //     ./in.cue:5:20
+  }
+}
diff --git a/cue/testdata/fulleval/051_detectIncompleteYAML.txtar b/cue/testdata/fulleval/051_detectIncompleteYAML.txtar
index 1cb714c..2cc08c1 100644
--- a/cue/testdata/fulleval/051_detectIncompleteYAML.txtar
+++ b/cue/testdata/fulleval/051_detectIncompleteYAML.txtar
@@ -66,3 +66,34 @@
 {"Val":{"data":{"baz":"var-string\n","foobar":"use: var-string\n"}}}
 -- out/legacy-debug --
 <0>{#Spec: <1>C{_vars: <2>C{something: string}, data: <3>C{#foo: <4>C{use: string}, baz: <5>.Marshal (<6>._vars.something), foobar: <5>.Marshal (<7>.#foo)}}, Val: <8>C{_vars: <9>C{something: "var-string"}, data: <10>C{#foo: <11>C{use: "var-string"}, baz: "var-string\n", foobar: "use: var-string\n"}}}
+-- out/eval --
+(struct){
+  #Spec: (#struct){
+    _vars: (#struct){
+      something: (string){ string }
+    }
+    data: (#struct){
+      #foo: (#struct){
+        use: (string){ string }
+      }
+      baz: (_|_){
+        // [incomplete] non-concrete argument 0
+      }
+      foobar: (_|_){
+        // [incomplete] incomplete value
+      }
+    }
+  }
+  Val: (#struct){
+    _vars: (#struct){
+      something: (string){ "var-string" }
+    }
+    data: (#struct){
+      #foo: (#struct){
+        use: (string){ "var-string" }
+      }
+      baz: (string){ "var-string\n" }
+      foobar: (string){ "use: var-string\n" }
+    }
+  }
+}
diff --git a/cue/testdata/fulleval/052_detectIncompleteJSON.txtar b/cue/testdata/fulleval/052_detectIncompleteJSON.txtar
index 5562506..84537c4 100644
--- a/cue/testdata/fulleval/052_detectIncompleteJSON.txtar
+++ b/cue/testdata/fulleval/052_detectIncompleteJSON.txtar
@@ -58,3 +58,34 @@
 {"Val":{"data":{"baz":"\"var-string\"","foobar":"{\"use\":\"var-string\"}"}}}
 -- out/legacy-debug --
 <0>{#Spec: <1>C{_vars: <2>C{something: string}, data: <3>C{#foo: <4>C{use: string}, baz: <5>.Marshal (<6>._vars.something), foobar: <5>.Marshal (<7>.#foo)}}, Val: <8>C{_vars: <9>C{something: "var-string"}, data: <10>C{#foo: <11>C{use: "var-string"}, baz: "\"var-string\"", foobar: "{\"use\":\"var-string\"}"}}}
+-- out/eval --
+(struct){
+  #Spec: (#struct){
+    _vars: (#struct){
+      something: (string){ string }
+    }
+    data: (#struct){
+      #foo: (#struct){
+        use: (string){ string }
+      }
+      baz: (_|_){
+        // [incomplete] non-concrete argument 0
+      }
+      foobar: (_|_){
+        // [incomplete] cannot convert incomplete value "string" to JSON
+      }
+    }
+  }
+  Val: (#struct){
+    _vars: (#struct){
+      something: (string){ "var-string" }
+    }
+    data: (#struct){
+      #foo: (#struct){
+        use: (string){ "var-string" }
+      }
+      baz: (string){ "\"var-string\"" }
+      foobar: (string){ "{\"use\":\"var-string\"}" }
+    }
+  }
+}
diff --git a/cue/testdata/fulleval/056_issue314.txtar b/cue/testdata/fulleval/056_issue314.txtar
index bd175a7..b480c77 100644
--- a/cue/testdata/fulleval/056_issue314.txtar
+++ b/cue/testdata/fulleval/056_issue314.txtar
@@ -75,3 +75,28 @@
 {"x":{"s":"myname","out":"myname"}}
 -- out/legacy-debug --
 <0>{x: <1>C{s: "myname", out: "myname"}, #T: <2>C{s: string, out: <3>.Execute ("{{.s}}",<4>C{s: <5>.s})}, #V: <6>C{s: string, out: <7>.Marshal (<8>C{s: <9>.s})}, #U: <10>C{s: string, out: <11>.Marshal (<12>C{s: <13>.s})}}
+-- out/eval --
+(struct){
+  x: (#struct){
+    s: (string){ "myname" }
+    out: (string){ "myname" }
+  }
+  #T: (#struct){
+    s: (string){ string }
+    out: (_|_){
+      // [incomplete] error in call to text/template.Execute: cannot convert incomplete value "string" to JSON
+    }
+  }
+  #V: (#struct){
+    s: (string){ string }
+    out: (_|_){
+      // [incomplete] cannot convert incomplete value "string" to JSON
+    }
+  }
+  #U: (#struct){
+    s: (string){ string }
+    out: (_|_){
+      // [incomplete] incomplete value
+    }
+  }
+}
diff --git a/cue/testdata/interpolation/041_interpolation.txtar b/cue/testdata/interpolation/041_interpolation.txtar
index a664fb9..ea2955d 100644
--- a/cue/testdata/interpolation/041_interpolation.txtar
+++ b/cue/testdata/interpolation/041_interpolation.txtar
@@ -33,7 +33,7 @@
 }
 -- out/eval --
 Errors:
-invalid interpolation: cannot use *adt.Vertex (type list) as type string:
+invalid interpolation: cannot use [] (type list) as type string:
     ./in.cue:7:4
 
 Result:
@@ -43,16 +43,16 @@
   b: (string){ "one 4 two 4one" }
   c: (string){ "one" }
   d: (_|_){
-    // [incomplete] invalid interpolation: incomplete string value '*adt.BasicType':
+    // [incomplete] invalid interpolation: incomplete string value '_':
     //     ./in.cue:4:4
   }
   u: (_|_){
-    // [incomplete] invalid interpolation: incomplete string value '*adt.Top':
+    // [incomplete] invalid interpolation: incomplete string value '_':
     //     ./in.cue:5:4
   }
   r: (_){ _ }
   e: (_|_){
-    // [eval] invalid interpolation: cannot use *adt.Vertex (type list) as type string:
+    // [eval] invalid interpolation: cannot use [] (type list) as type string:
     //     ./in.cue:7:4
   }
 }
diff --git a/cue/testdata/lists/020_list_arithmetic.txtar b/cue/testdata/lists/020_list_arithmetic.txtar
index 6802546..cfc9f85 100644
--- a/cue/testdata/lists/020_list_arithmetic.txtar
+++ b/cue/testdata/lists/020_list_arithmetic.txtar
@@ -360,11 +360,11 @@
   l2: (#list){
   }
   l3: (_|_){
-    // [incomplete] non-concrete value *adt.BoundValue in operand to *:
+    // [incomplete] non-concrete value <=2 in operand to *:
     //     ./in.cue:4:5
   }
   l4: (_|_){
-    // [incomplete] non-concrete value *adt.BoundValue in operand to *:
+    // [incomplete] non-concrete value <=2 in operand to *:
     //     ./in.cue:5:5
   }
   l5: (_|_){
diff --git a/cue/testdata/packages/embed.txtar b/cue/testdata/packages/embed.txtar
new file mode 100644
index 0000000..c9a3379
--- /dev/null
+++ b/cue/testdata/packages/embed.txtar
@@ -0,0 +1,42 @@
+cue eval ./pkg:foo
+
+-- cue.mod/module.cue --
+module: "example.com"
+
+-- in.cue --
+package foo
+
+import "example.com/pkg:bar"
+bar
+z: 3
+
+-- pkg/bar.cue --
+package bar
+
+import "example.com/pkg:baz"
+foo: {
+    baz
+    y: 2
+}
+foo
+
+-- pkg/baz.cue --
+package baz
+
+x: 1
+-- out/eval --
+(struct){
+  foo: (struct){
+    x: (int){ 1 }
+    y: (int){ 2 }
+  }
+  z: (int){ 3 }
+  x: (int){ 1 }
+  y: (int){ 2 }
+}
+-- out/compile --
+--- in.cue
+{
+  〈import;"example.com/pkg:bar"〉
+  z: 3
+}
diff --git a/cue/testdata/packages/sub.txtar b/cue/testdata/packages/sub.txtar
new file mode 100644
index 0000000..add9bae
--- /dev/null
+++ b/cue/testdata/packages/sub.txtar
@@ -0,0 +1,29 @@
+cue eval ./pkg:foo
+
+-- cue.mod/module.cue --
+module: "example.com"
+
+-- in.cue --
+package test
+
+import pkg2 "example.com/foo/pkg1"
+#pkg1: pkg2.Object
+
+"Hello \(#pkg1)!"
+
+-- foo/pkg1/file.cue --
+package pkg1
+
+Object: "World"
+
+-- out/eval --
+(string){
+  "Hello World!"
+  #pkg1: (string){ "World" }
+}
+-- out/compile --
+--- in.cue
+{
+  #pkg1: 〈import;"example.com/foo/pkg1"〉.Object
+  "Hello \(〈0;#pkg1〉)!"
+}
diff --git a/cue/testdata/resolve/006_arithmetic.txtar b/cue/testdata/resolve/006_arithmetic.txtar
index 288a4b1..9542e1d 100644
--- a/cue/testdata/resolve/006_arithmetic.txtar
+++ b/cue/testdata/resolve/006_arithmetic.txtar
@@ -30,7 +30,7 @@
 }
 -- out/eval --
 Errors:
-invalid value *adt.Num (mismatched types float and int)
+invalid value 2 (mismatched types float and int)
 
 Result:
 (_|_){
@@ -41,6 +41,6 @@
   v5: (float){ 2.0 }
   v6: (float){ 1 }
   e2: (_|_){
-    // [eval] invalid value *adt.Num (mismatched types float and int)
+    // [eval] invalid value 2 (mismatched types float and int)
   }
 }
diff --git a/cue/testdata/resolve/011_bounds.txtar b/cue/testdata/resolve/011_bounds.txtar
index ae2af98..7fdc302 100644
--- a/cue/testdata/resolve/011_bounds.txtar
+++ b/cue/testdata/resolve/011_bounds.txtar
@@ -138,11 +138,15 @@
 }
 -- out/eval --
 Errors:
-bounds *adt.BoundValue *adt.BoundValue
-invalid value *adt.BoundValue (mismatched types (bool|string|bytes|list|struct|number) and null)
-invalid value *adt.BoundValue (mismatched types number and string)
-invalid value *adt.Null (mismatched types null and (bool|string|bytes|list|struct|number))
-invalid value *adt.Num (out of bound *adt.BoundValue)
+bounds >1 <0
+bounds >11 <11
+bounds >11 <=11
+bounds >=11 <11
+invalid value !=null (mismatched types (bool|string|bytes|list|struct|number) and null)
+invalid value 0 (out of bound <0)
+invalid value 1 (out of bound >1)
+invalid value <1 (mismatched types number and string)
+invalid value null (mismatched types null and (bool|string|bytes|list|struct|number))
 
 Result:
 (_|_){
@@ -178,30 +182,30 @@
   s23e: (number){ &(>0.0, <2.0) }
   s30: (int){ &(>0, int) }
   e1: (_|_){
-    // [eval] invalid value *adt.BoundValue (mismatched types (bool|string|bytes|list|struct|number) and null)
+    // [eval] invalid value !=null (mismatched types (bool|string|bytes|list|struct|number) and null)
   }
   e2: (_|_){
-    // [eval] invalid value *adt.Null (mismatched types null and (bool|string|bytes|list|struct|number))
+    // [eval] invalid value null (mismatched types null and (bool|string|bytes|list|struct|number))
   }
   e3: (_|_){
-    // [eval] invalid value *adt.Num (out of bound *adt.BoundValue)
+    // [eval] invalid value 1 (out of bound >1)
   }
   e4: (_|_){
-    // [eval] invalid value *adt.Num (out of bound *adt.BoundValue)
+    // [eval] invalid value 0 (out of bound <0)
   }
   e5: (_|_){
-    // [eval] bounds *adt.BoundValue *adt.BoundValue
+    // [eval] bounds >1 <0
   }
   e6: (_|_){
-    // [eval] bounds *adt.BoundValue *adt.BoundValue
+    // [eval] bounds >11 <11
   }
   e7: (_|_){
-    // [eval] bounds *adt.BoundValue *adt.BoundValue
+    // [eval] bounds >=11 <11
   }
   e8: (_|_){
-    // [eval] bounds *adt.BoundValue *adt.BoundValue
+    // [eval] bounds >11 <=11
   }
   e9: (_|_){
-    // [eval] invalid value *adt.BoundValue (mismatched types number and string)
+    // [eval] invalid value <1 (mismatched types number and string)
   }
 }
diff --git a/cue/testdata/resolve/012_bound_conversions.txtar b/cue/testdata/resolve/012_bound_conversions.txtar
index ed2f919..a1fe706 100644
--- a/cue/testdata/resolve/012_bound_conversions.txtar
+++ b/cue/testdata/resolve/012_bound_conversions.txtar
@@ -48,8 +48,8 @@
 }
 -- out/eval --
 Errors:
-invalid value *adt.BasicType (mismatched types int and float)
-invalid value *adt.Num (out of bound *adt.BoundValue)
+invalid value 1.2 (out of bound >1.3)
+invalid value int (mismatched types int and float)
 
 Result:
 (_|_){
@@ -62,13 +62,13 @@
   r5: (number){ 1.1 }
   r6: (number){ 1.1 }
   c1: (_|_){
-    // [eval] invalid value *adt.Num (out of bound *adt.BoundValue)
+    // [eval] invalid value 1.2 (out of bound >1.3)
   }
   c2: (_|_){
-    // [eval] invalid value *adt.Num (out of bound *adt.BoundValue)
+    // [eval] invalid value 1.2 (out of bound >1.3)
   }
   c3: (float){ 1.2 }
   c4: (_|_){
-    // [eval] invalid value *adt.BasicType (mismatched types int and float)
+    // [eval] invalid value int (mismatched types int and float)
   }
 }
diff --git a/cue/testdata/resolve/013_custom_validators.txtar b/cue/testdata/resolve/013_custom_validators.txtar
index 25b566a..8a245c9 100644
--- a/cue/testdata/resolve/013_custom_validators.txtar
+++ b/cue/testdata/resolve/013_custom_validators.txtar
@@ -19,3 +19,16 @@
 c: "dog"
 -- out/legacy-debug --
 <0>{a: "after", b: _|_(strings.ContainsAny ("c"):invalid value "dog" (does not satisfy strings.ContainsAny("c"))), c: "dog"}
+-- out/eval --
+Errors:
+invalid value "dog" (does not satisfy strings.ContainsAny("c"))
+
+Result:
+(_|_){
+  // [eval]
+  a: (string){ "after" }
+  b: (_|_){
+    // [eval] invalid value "dog" (does not satisfy strings.ContainsAny("c"))
+  }
+  c: (string){ "dog" }
+}
diff --git a/cue/testdata/resolve/016_index.txtar b/cue/testdata/resolve/016_index.txtar
index b655962..f0ce0fc 100644
--- a/cue/testdata/resolve/016_index.txtar
+++ b/cue/testdata/resolve/016_index.txtar
@@ -90,7 +90,7 @@
     ./in.cue:8:5
 undefined field 3:
     ./in.cue:9:15
-invalid negative index *adt.Num:
+invalid negative index -1:
     ./in.cue:10:5
 invalid list index 1 (out of bounds):
     ./in.cue:11:16
@@ -127,7 +127,7 @@
     //     ./in.cue:9:15
   }
   e5: (_|_){
-    // [eval] invalid negative index *adt.Num:
+    // [eval] invalid negative index -1:
     //     ./in.cue:10:5
   }
   e6: (_|_){
diff --git a/cue/testdata/resolve/018_slice.txtar b/cue/testdata/resolve/018_slice.txtar
index 6884914..28b206d 100644
--- a/cue/testdata/resolve/018_slice.txtar
+++ b/cue/testdata/resolve/018_slice.txtar
@@ -61,11 +61,11 @@
     ./in.cue:5:5
 index 2 out of range:
     ./in.cue:6:5
-cannot slice *adt.Num (type int):
+cannot slice 4 (type int):
     ./in.cue:7:5
-cannot use *adt.String (type string) as type int in slice index:
+cannot use "" (type string) as type int in slice index:
     ./in.cue:8:5
-cannot use *adt.String (type string) as type int in slice index:
+cannot use "9" (type string) as type int in slice index:
     ./in.cue:9:5
 
 Result:
@@ -92,15 +92,15 @@
     //     ./in.cue:6:5
   }
   e5: (_|_){
-    // [eval] cannot slice *adt.Num (type int):
+    // [eval] cannot slice 4 (type int):
     //     ./in.cue:7:5
   }
   e6: (_|_){
-    // [eval] cannot use *adt.String (type string) as type int in slice index:
+    // [eval] cannot use "" (type string) as type int in slice index:
     //     ./in.cue:8:5
   }
   e7: (_|_){
-    // [eval] cannot use *adt.String (type string) as type int in slice index:
+    // [eval] cannot use "9" (type string) as type int in slice index:
     //     ./in.cue:9:5
   }
 }
diff --git a/cue/testdata/resolve/023_correct_error_messages.txtar b/cue/testdata/resolve/023_correct_error_messages.txtar
index d8ac97d..9d79f85 100644
--- a/cue/testdata/resolve/023_correct_error_messages.txtar
+++ b/cue/testdata/resolve/023_correct_error_messages.txtar
@@ -15,12 +15,12 @@
 }
 -- out/eval --
 Errors:
-invalid value *adt.Num (mismatched types int and string)
+invalid value 1 (mismatched types int and string)
 
 Result:
 (_|_){
   // [eval]
   a: (_|_){
-    // [eval] invalid value *adt.Num (mismatched types int and string)
+    // [eval] invalid value 1 (mismatched types int and string)
   }
 }
diff --git a/cue/testdata/resolve/024_structs.txtar b/cue/testdata/resolve/024_structs.txtar
index f9d3a35..0f09834 100644
--- a/cue/testdata/resolve/024_structs.txtar
+++ b/cue/testdata/resolve/024_structs.txtar
@@ -53,14 +53,14 @@
   t: (struct){
     c: (number){ number }
     d: (_|_){
-      // [incomplete] non-concrete value *adt.BasicType in operand to *:
+      // [incomplete] non-concrete value number in operand to *:
       //     ./in.cue:3:19
     }
   }
   ti: (struct){
     c: (int){ int }
     d: (_|_){
-      // [incomplete] non-concrete value *adt.BasicType in operand to *:
+      // [incomplete] non-concrete value int in operand to *:
       //     ./in.cue:3:19
     }
   }
diff --git a/cue/testdata/resolve/039_reference_to_root.txtar b/cue/testdata/resolve/039_reference_to_root.txtar
index c13bba8..451d91c 100644
--- a/cue/testdata/resolve/039_reference_to_root.txtar
+++ b/cue/testdata/resolve/039_reference_to_root.txtar
@@ -85,14 +85,14 @@
   c: (struct){
     b: (int){ 100 }
     d: (_|_){
-      // [incomplete] non-concrete value *adt.BasicType in operand to +:
+      // [incomplete] non-concrete value int in operand to +:
       //     ./in.cue:4:5
     }
   }
   x: (struct){
     b: (int){ int }
     c: (_|_){
-      // [incomplete] non-concrete value *adt.BasicType in operand to +:
+      // [incomplete] non-concrete value int in operand to +:
       //     ./in.cue:8:5
     }
   }
@@ -103,21 +103,21 @@
   v: (struct){
     b: (int){ int }
     c: (_|_){
-      // [incomplete] non-concrete value *adt.BasicType in operand to +:
+      // [incomplete] non-concrete value int in operand to +:
       //     ./in.cue:16:5
     }
   }
   w: (struct){
     b: (int){ 100 }
     c: (_|_){
-      // [incomplete] non-concrete value *adt.BasicType in operand to +:
+      // [incomplete] non-concrete value int in operand to +:
       //     ./in.cue:16:5
     }
   }
   wp: (struct){
     b: (int){ 100 }
     c: (_|_){
-      // [incomplete] non-concrete value *adt.BasicType in operand to +:
+      // [incomplete] non-concrete value int in operand to +:
       //     ./in.cue:16:5
     }
   }
diff --git a/cue/testdata/resolve/045_range_unification.txtar b/cue/testdata/resolve/045_range_unification.txtar
index 42668f6..28c3b71 100644
--- a/cue/testdata/resolve/045_range_unification.txtar
+++ b/cue/testdata/resolve/045_range_unification.txtar
@@ -134,10 +134,13 @@
 }
 -- out/eval --
 Errors:
-bounds *adt.BoundValue *adt.BoundValue
-invalid value *adt.BasicType (mismatched types string and number)
-invalid value *adt.BoundValue (mismatched types number and string)
-invalid value *adt.Num (out of bound *adt.BoundValue)
+bounds >=1.1 <=1.3
+bounds >=6 <=5
+invalid value 0 (out of bound >=1)
+invalid value 6 (out of bound <=5)
+invalid value <=5 (mismatched types number and string)
+invalid value >=1 (mismatched types number and string)
+invalid value string (mismatched types string and number)
 
 Result:
 (_|_){
@@ -146,19 +149,19 @@
   a2: (int){ 1 }
   a3: (int){ 5 }
   a4: (_|_){
-    // [eval] invalid value *adt.Num (out of bound *adt.BoundValue)
+    // [eval] invalid value 6 (out of bound <=5)
   }
   a5: (_|_){
-    // [eval] invalid value *adt.Num (out of bound *adt.BoundValue)
+    // [eval] invalid value 0 (out of bound >=1)
   }
   a6: (int){ 3 }
   a7: (int){ 1 }
   a8: (int){ 5 }
   a9: (_|_){
-    // [eval] invalid value *adt.Num (out of bound *adt.BoundValue)
+    // [eval] invalid value 6 (out of bound <=5)
   }
   a10: (_|_){
-    // [eval] invalid value *adt.Num (out of bound *adt.BoundValue)
+    // [eval] invalid value 0 (out of bound >=1)
   }
   b1: (number){ &(>=1, <=5) }
   b2: (number){ 1 }
@@ -167,7 +170,7 @@
   b5: (number){ &(>=3, <=5) }
   b6: (number){ 5 }
   b7: (_|_){
-    // [eval] bounds *adt.BoundValue *adt.BoundValue
+    // [eval] bounds >=6 <=5
   }
   b8: (number){ &(>=1, <=5) }
   b9: (number){ 1 }
@@ -176,21 +179,22 @@
   b12: (number){ &(>=3, <=5) }
   b13: (number){ 5 }
   b14: (_|_){
-    // [eval] bounds *adt.BoundValue *adt.BoundValue
+    // [eval] bounds >=6 <=5
   }
   c1: (int){ &(>=1, <=5, int) }
   c2: (int){ &(>=1, <=5, int) }
   c3: (_|_){
-    // [eval] invalid value *adt.BoundValue (mismatched types number and string)
+    // [eval] invalid value <=5 (mismatched types number and string)
+    // invalid value >=1 (mismatched types number and string)
   }
   c4: (_|_){
-    // [eval] invalid value *adt.BasicType (mismatched types string and number)
+    // [eval] invalid value string (mismatched types string and number)
   }
   s1: (string){ "e" }
   s2: (string){ "ee" }
   n1: (number){ &(>=1, <=2) }
   n2: (_|_){
-    // [eval] bounds *adt.BoundValue *adt.BoundValue
+    // [eval] bounds >=1.1 <=1.3
   }
   n3: (int){ 2 }
   n4: (float){ 0.09999 }
diff --git a/cue/testdata/resolve/046_predefined_ranges.txtar b/cue/testdata/resolve/046_predefined_ranges.txtar
index 83840a7..784a9f4 100644
--- a/cue/testdata/resolve/046_predefined_ranges.txtar
+++ b/cue/testdata/resolve/046_predefined_ranges.txtar
@@ -29,7 +29,7 @@
 }
 -- out/eval --
 Errors:
-invalid value *adt.Num (out of bound *adt.BoundValue)
+invalid value 100000 (out of bound <=32767)
 
 Result:
 (_|_){
@@ -37,6 +37,6 @@
   k1: (int){ 44 }
   k2: (int){ -8000000000 }
   e1: (_|_){
-    // [eval] invalid value *adt.Num (out of bound *adt.BoundValue)
+    // [eval] invalid value 100000 (out of bound <=32767)
   }
 }
diff --git a/cue/testdata/resolve/048_builtins.txtar b/cue/testdata/resolve/048_builtins.txtar
index 0312445..4007367 100644
--- a/cue/testdata/resolve/048_builtins.txtar
+++ b/cue/testdata/resolve/048_builtins.txtar
@@ -46,7 +46,8 @@
 <0>{a1: <1>{a: (=~"oo" & =~"fo"), b: =~"oo", c: =~"fo"}, a2: <2>{a: "foo", b: =~"oo", c: =~"fo"}, a3: <3>{a: _|_((=~"oo" & "bar"):invalid value "bar" (does not match =~"oo")), b: =~"oo", c: =~"fo"}, o1: <4>{a: string, b: string, c: "bar"}, o2: <5>{a: "foo", b: string, c: "bar"}, o3: <6>{a: _|_(("baz" & "foo"):empty disjunction: conflicting values "baz" and "foo";("bar" & "foo"):empty disjunction: conflicting values "bar" and "foo"), b: "baz", c: "bar"}}
 -- out/eval --
 Errors:
-invalid value *adt.Vertex (out of bound *adt.BoundValue)
+invalid value "bar" (out of bound =~"fo")
+invalid value "bar" (out of bound =~"oo")
 
 Result:
 (_|_){
@@ -64,7 +65,8 @@
   a3: (_|_){
     // [eval]
     a: (_|_){
-      // [eval] invalid value *adt.Vertex (out of bound *adt.BoundValue)
+      // [eval] invalid value "bar" (out of bound =~"fo")
+      // invalid value "bar" (out of bound =~"oo")
     }
     b: (string){ =~"oo" }
     c: (string){ =~"fo" }
diff --git a/internal/core/eval/eval_test.go b/internal/core/eval/eval_test.go
index 34fded1..0d465f7 100644
--- a/internal/core/eval/eval_test.go
+++ b/internal/core/eval/eval_test.go
@@ -12,22 +12,21 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package eval
+package eval_test
 
 import (
 	"flag"
 	"fmt"
 	"testing"
 
-	"cuelang.org/go/cue/format"
-	"cuelang.org/go/cue/parser"
 	"cuelang.org/go/internal/core/adt"
-	"cuelang.org/go/internal/core/compile"
 	"cuelang.org/go/internal/core/debug"
-	"cuelang.org/go/internal/core/runtime"
+	"cuelang.org/go/internal/core/eval"
 	"cuelang.org/go/internal/core/validate"
 	"cuelang.org/go/internal/cuetxtar"
+	"cuelang.org/go/internal/legacy/cue"
 	"cuelang.org/go/pkg/strings"
+	"github.com/rogpeppe/go-internal/txtar"
 )
 
 var (
@@ -48,23 +47,19 @@
 		test.ToDo = nil
 	}
 
-	r := runtime.New()
+	r := cue.NewRuntime()
 
 	test.Run(t, func(t *cuetxtar.Test) {
 		a := t.ValidInstances()
 
-		v, err := compile.Files(nil, r, a[0].Files...)
+		v, err := r.Build(a[0])
 		if err != nil {
 			t.Fatal(err)
 		}
 
-		e := Evaluator{
-			r:     r,
-			index: r,
-		}
+		ctx := eval.NewContext(r, v)
+		v.Finalize(ctx)
 
-		err = e.Eval(v)
-		t.WriteErrors(err)
 		if b := validate.Validate(r, v, &validate.Config{
 			AllErrors: true,
 		}); b != nil {
@@ -88,13 +83,6 @@
 }
 
 var needFix = map[string]string{
-	"fulleval/048_dont_pass_incomplete_values_to_builtins": "import",
-	"fulleval/050_json_Marshaling_detects_incomplete":      "import",
-	"fulleval/051_detectIncompleteYAML":                    "import",
-	"fulleval/052_detectIncompleteJSON":                    "import",
-	"fulleval/056_issue314":                                "import",
-	"resolve/013_custom_validators":                        "import",
-
 	"export/027": "cycle",
 	"export/028": "cycle",
 	"export/030": "cycle",
@@ -108,46 +96,32 @@
 
 // TestX is for debugging. Do not delete.
 func TestX(t *testing.T) {
-	t.Skip()
 	in := `
-	// max: >99 | *((5|*1) & 5)
-	// *( 5 | *_|_ )
-	// 1 | *((5|*1) & 5)
+-- cue.mod/module.cue --
+module: "example.com"
 
-
-	max: >= (num+0) | * (num+0)
-	res: !=4 | * 1
-	num:  *(1+(res+0)) | >(res+0)
-
-    // (1 | *2 | 3) & (1 | 2 | *3)
-
-	// m1: (*1 | (*2 | 3)) & (>=2 & <=3)
-	// m2: (*1 | (*2 | 3)) & (2 | 3)
-	// m3: (*1 | *(*2 | 3)) & (2 | 3)
-	// b: (*"a" | "b") | "c"
-	// {a: 1} | {b: 2}
+-- in.cue --
 	`
 
-	if strings.TrimSpace(in) == "" {
+	if strings.HasSuffix(strings.TrimSpace(in), ".cue --") {
 		t.Skip()
 	}
 
-	file, err := parser.ParseFile("TestX", in)
+	a := txtar.Parse([]byte(in))
+	instance := cuetxtar.Load(a, "/tmp/test")[0]
+	if instance.Err != nil {
+		t.Fatal(instance.Err)
+	}
+
+	r := cue.NewRuntime()
+
+	v, err := r.Build(instance)
 	if err != nil {
 		t.Fatal(err)
 	}
-	r := runtime.New()
+	t.Error(debug.NodeString(r, v, nil))
 
-	b, err := format.Node(file)
-	_, _ = b, err
-	// fmt.Println(string(b), err)
-
-	v, err := compile.Files(nil, r, file)
-	if err != nil {
-		t.Fatal(err)
-	}
-
-	ctx := NewContext(r, v)
+	ctx := eval.NewContext(r, v)
 
 	ctx.Unify(ctx, v, adt.Finalized)
 	// if err != nil {
diff --git a/internal/legacy/cue/builtin.go b/internal/legacy/cue/builtin.go
index 79b4a75..cfdba45 100644
--- a/internal/legacy/cue/builtin.go
+++ b/internal/legacy/cue/builtin.go
@@ -12,7 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-//go:generate go run gen.go
 //go:generate go run golang.org/x/tools/cmd/goimports -w -local cuelang.org/go builtins.go
 //go:generate gofmt -s -w builtins.go