-- in.cue --
_Q: [{pos: 0}, {pos: 1}]

a: [rn=string]: _Q[0:len(a[rn])]
a: ben: [{}]

b: [rn=string]: _Q[0:1]
b: ben: [{}]

c: [rn=string]: [...{l: len(a[rn])}]
c: ben: [{}]

#d: [rn=string]: [...{pos: uint}] & _Q[0:len(#d[rn])]
#d: ben: [{}]

d: #d

e: [rn=string]: _Q[0 : len(a[rn])+1]
e: ben: [{}, ...]

f: [rn=string]: _Q[0 : len(a[rn])+1]
f: ben: [{}]

g: [rn=string]: _Q[0:len(a[rn])]
g: ben: [{}, {}]
-- out/eval/stats --
Leaks:  0
Freed:  43
Reused: 38
Allocs: 5
Retain: 0

Unifications: 43
Conjuncts:    83
Disjuncts:    45
-- out/evalalpha --
Errors:
f.ben: incompatible list lengths (1 and 2)
g.ben: incompatible list lengths (1 and 2)

Result:
(_|_){
  // [eval]
  _Q: (#list){
    0: (struct){
      pos: (int){ 0 }
    }
    1: (struct){
      pos: (int){ 1 }
    }
  }
  a: (struct){
    ben: (#list){
      0: (struct){
        pos: (int){ 0 }
      }
    }
  }
  b: (struct){
    ben: (#list){
      0: (struct){
        pos: (int){ 0 }
      }
    }
  }
  c: (struct){
    ben: (#list){
      0: (struct){
        l: (int){ 1 }
      }
    }
  }
  #d: (#struct){
    ben: (#list){
      0: (#struct){
        pos: (int){ 0 }
      }
    }
  }
  d: ~(#d)
  e: (struct){
    ben: (#list){
      0: (struct){
        pos: (int){ 0 }
      }
      1: (struct){
        pos: (int){ 1 }
      }
    }
  }
  f: (_|_){
    // [eval]
    ben: (_|_){
      // [eval] f.ben: incompatible list lengths (1 and 2)
      0: (struct){
      }
    }
  }
  g: (_|_){
    // [eval]
    ben: (_|_){
      // [eval] g.ben: incompatible list lengths (1 and 2)
      0: (struct){
      }
      1: (struct){
      }
    }
  }
}
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
+++ new
@@ -41,13 +41,7 @@
       }
     }
   }
-  d: (#struct){
-    ben: (#list){
-      0: (#struct){
-        pos: (int){ 0 }
-      }
-    }
-  }
+  d: ~(#d)
   e: (struct){
     ben: (#list){
       0: (struct){
@@ -63,10 +57,6 @@
     ben: (_|_){
       // [eval] f.ben: incompatible list lengths (1 and 2)
       0: (struct){
-        pos: (int){ 0 }
-      }
-      1: (struct){
-        pos: (int){ 1 }
       }
     }
   }
@@ -75,7 +65,6 @@
     ben: (_|_){
       // [eval] g.ben: incompatible list lengths (1 and 2)
       0: (struct){
-        pos: (int){ 0 }
       }
       1: (struct){
       }
-- diff/todo/p2 --
error path moved
-- out/eval --
Errors:
f.ben: incompatible list lengths (1 and 2)
g.ben: incompatible list lengths (1 and 2)

Result:
(_|_){
  // [eval]
  _Q: (#list){
    0: (struct){
      pos: (int){ 0 }
    }
    1: (struct){
      pos: (int){ 1 }
    }
  }
  a: (struct){
    ben: (#list){
      0: (struct){
        pos: (int){ 0 }
      }
    }
  }
  b: (struct){
    ben: (#list){
      0: (struct){
        pos: (int){ 0 }
      }
    }
  }
  c: (struct){
    ben: (#list){
      0: (struct){
        l: (int){ 1 }
      }
    }
  }
  #d: (#struct){
    ben: (#list){
      0: (#struct){
        pos: (int){ 0 }
      }
    }
  }
  d: (#struct){
    ben: (#list){
      0: (#struct){
        pos: (int){ 0 }
      }
    }
  }
  e: (struct){
    ben: (#list){
      0: (struct){
        pos: (int){ 0 }
      }
      1: (struct){
        pos: (int){ 1 }
      }
    }
  }
  f: (_|_){
    // [eval]
    ben: (_|_){
      // [eval] f.ben: incompatible list lengths (1 and 2)
      0: (struct){
        pos: (int){ 0 }
      }
      1: (struct){
        pos: (int){ 1 }
      }
    }
  }
  g: (_|_){
    // [eval]
    ben: (_|_){
      // [eval] g.ben: incompatible list lengths (1 and 2)
      0: (struct){
        pos: (int){ 0 }
      }
      1: (struct){
      }
    }
  }
}
-- out/compile --
--- in.cue
{
  _Q: [
    {
      pos: 0
    },
    {
      pos: 1
    },
  ]
  a: {
    [string]: 〈1;_Q〉[0:len(〈1;a〉[〈0;-〉])]
  }
  a: {
    ben: [
      {},
    ]
  }
  b: {
    [string]: 〈1;_Q〉[0:1]
  }
  b: {
    ben: [
      {},
    ]
  }
  c: {
    [string]: [
      ...{
        l: len(〈3;a〉[〈2;-〉])
      },
    ]
  }
  c: {
    ben: [
      {},
    ]
  }
  #d: {
    [string]: ([
      ...{
        pos: &(int, >=0)
      },
    ] & 〈1;_Q〉[0:len(〈1;#d〉[〈0;-〉])])
  }
  #d: {
    ben: [
      {},
    ]
  }
  d: 〈0;#d〉
  e: {
    [string]: 〈1;_Q〉[0:(len(〈1;a〉[〈0;-〉]) + 1)]
  }
  e: {
    ben: [
      {},
      ...,
    ]
  }
  f: {
    [string]: 〈1;_Q〉[0:(len(〈1;a〉[〈0;-〉]) + 1)]
  }
  f: {
    ben: [
      {},
    ]
  }
  g: {
    [string]: 〈1;_Q〉[0:len(〈1;a〉[〈0;-〉])]
  }
  g: {
    ben: [
      {},
      {},
    ]
  }
}
