-- in.cue --
structShorthand: X={b: 3, c: X.b}

// Note that X and Y are subtly different, as they have different bindings:
// one binds to the field, the other to the value. In this case, that does not
// make a difference.
fieldAndValue: X=foo: Y={3, #sum: X + Y}

valueCycle: b: X=3 + X

// Issue #1003
listValueAlias: X = [1, 2, X[0]]
-- out/eval/stats --
Leaks:  0
Freed:  13
Reused: 9
Allocs: 4
Retain: 0

Unifications: 13
Conjuncts:    20
Disjuncts:    13
-- out/evalalpha --
(struct){
  structShorthand: (struct){
    b: (int){ 3 }
    c: (int){ 3 }
  }
  fieldAndValue: (struct){
    foo: (int){
      3
      #sum: (int){ 6 }
    }
  }
  valueCycle: (struct){
    b: (_|_){
      // [cycle] valueCycle.b: cycle with field: X:
      //     ./in.cue:8:22
    }
  }
  listValueAlias: (#list){
    0: (int){ 1 }
    1: (int){ 2 }
    2: (int){ 1 }
  }
}
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
+++ new
@@ -11,8 +11,8 @@
   }
   valueCycle: (struct){
     b: (_|_){
-      // [cycle] cycle error:
-      //     ./in.cue:8:18
+      // [cycle] valueCycle.b: cycle with field: X:
+      //     ./in.cue:8:22
     }
   }
   listValueAlias: (#list){
-- out/eval --
(struct){
  structShorthand: (struct){
    b: (int){ 3 }
    c: (int){ 3 }
  }
  fieldAndValue: (struct){
    foo: (int){
      3
      #sum: (int){ 6 }
    }
  }
  valueCycle: (struct){
    b: (_|_){
      // [cycle] cycle error:
      //     ./in.cue:8:18
    }
  }
  listValueAlias: (#list){
    0: (int){ 1 }
    1: (int){ 2 }
    2: (int){ 1 }
  }
}
-- out/compile --
--- in.cue
{
  structShorthand: {
    b: 3
    c: 〈1〉.b
  }
  fieldAndValue: {
    foo: {
      3
      #sum: (〈1;foo〉 + 〈1〉)
    }
  }
  valueCycle: {
    b: (3 + 〈0〉)
  }
  listValueAlias: [
    1,
    2,
    〈1〉[0],
  ]
}
