-- in.cue --
root: {
	a: {
		$id: "list"
		out: [...int]
	}
	middle: {
		for x in a.out if x > 1 {
			"la\(x)": {
				$id: "sequenced"
				seq: x
				val: "foo\(x)"
			}
		}
	}
	// Run this after all generated tasks (so far)
	b: {
		$id: "list"
		$after: [for x in middle {x}]
		out: [...int]
	}
	after: {
		for x in b.out if x > 1 {
			"lb\(x)": {
				$id: "valToOut"
				val: "foo\(x)"
			}
		}
	}
}
-- out/run/errors --
-- out/run/t0 --
graph TD
  t0("root.a [Ready]")
  t1("root.b [Waiting]")
  t1-->t0

-- out/run/t1 --
graph TD
  t0("root.a [Terminated]")
  t1("root.b [Waiting]")
  t1-->t0
  t1-->t2
  t2("root.middle.la2 [Ready]")
  t2-->t0

-- out/run/t1/value --
{
	$id: "list"
	out: [1, 2]
}
-- out/run/t2 --
graph TD
  t0("root.a [Terminated]")
  t1("root.b [Ready]")
  t1-->t0
  t1-->t2
  t2("root.middle.la2 [Terminated]")
  t2-->t0

-- out/run/t2/value --
{
	$id: "sequenced"
	out: "foo2"
	seq: 2
	val: "foo2"
}
-- out/run/t3 --
graph TD
  t0("root.a [Terminated]")
  t1("root.b [Terminated]")
  t1-->t0
  t1-->t2
  t2("root.middle.la2 [Terminated]")
  t2-->t0
  t3("root.after.lb2 [Ready]")
  t3-->t1

-- out/run/t3/value --
{
	$id: "list"
	$after: [{
		$id: "sequenced"
		out: "foo2"
		seq: 2
		val: "foo2"
	}]
	out: [1, 2]
}
-- out/run/t4 --
graph TD
  t0("root.a [Terminated]")
  t1("root.b [Terminated]")
  t1-->t0
  t1-->t2
  t2("root.middle.la2 [Terminated]")
  t2-->t0
  t3("root.after.lb2 [Terminated]")
  t3-->t1

-- out/run/t4/value --
{
	$id: "valToOut"
	out: "foo2"
	val: "foo2"
}
-- out/run-v3/t1/stats --
Leaks:  0
Freed:  21
Reused: 8
Allocs: 13
Retain: 0

Unifications: 21
Conjuncts:    31
Disjuncts:    0
ResolveDep:   10

NumCloseIDs: 8
-- diff/-out/run-v3/t1/stats<==>+out/run/t1/stats --
diff old new
--- old
+++ new
@@ -1,13 +1,12 @@
 Leaks:  0
 Freed:  21
-Reused: 15
-Allocs: 6
+Reused: 8
+Allocs: 13
 Retain: 0
 
 Unifications: 21
-Conjuncts:    35
-Disjuncts:    21
-
-MisalignedConjunct: 3
-
-NumCloseIDs: 2
+Conjuncts:    31
+Disjuncts:    0
+ResolveDep:   10
+
+NumCloseIDs: 8
-- out/run/t1/stats --
Leaks:  0
Freed:  21
Reused: 15
Allocs: 6
Retain: 0

Unifications: 21
Conjuncts:    35
Disjuncts:    21

MisalignedConjunct: 3

NumCloseIDs: 2
-- out/run-v3/t2/stats --
Leaks:  0
Freed:  23
Reused: 22
Allocs: 1
Retain: 0

Unifications: 23
Conjuncts:    38
Disjuncts:    0
ResolveDep:   10

NumCloseIDs: 8
-- diff/-out/run-v3/t2/stats<==>+out/run/t2/stats --
diff old new
--- old
+++ new
@@ -1,13 +1,12 @@
 Leaks:  0
 Freed:  23
-Reused: 23
-Allocs: 0
+Reused: 22
+Allocs: 1
 Retain: 0
 
 Unifications: 23
-Conjuncts:    44
-Disjuncts:    23
-
-MisalignedConjunct: 4
-
-NumCloseIDs: 2
+Conjuncts:    38
+Disjuncts:    0
+ResolveDep:   10
+
+NumCloseIDs: 8
-- out/run/t2/stats --
Leaks:  0
Freed:  23
Reused: 23
Allocs: 0
Retain: 0

Unifications: 23
Conjuncts:    44
Disjuncts:    23

MisalignedConjunct: 4

NumCloseIDs: 2
-- out/run-v3/t3/stats --
Leaks:  0
Freed:  28
Reused: 28
Allocs: 0
Retain: 0

Unifications: 28
Conjuncts:    51
Disjuncts:    0
ResolveDep:   16

NumCloseIDs: 9
-- diff/-out/run-v3/t3/stats<==>+out/run/t3/stats --
diff old new
--- old
+++ new
@@ -5,9 +5,8 @@
 Retain: 0
 
 Unifications: 28
-Conjuncts:    57
-Disjuncts:    28
-
-MisalignedConjunct: 5
-
-NumCloseIDs: 2
+Conjuncts:    51
+Disjuncts:    0
+ResolveDep:   16
+
+NumCloseIDs: 9
-- out/run/t3/stats --
Leaks:  0
Freed:  28
Reused: 28
Allocs: 0
Retain: 0

Unifications: 28
Conjuncts:    57
Disjuncts:    28

MisalignedConjunct: 5

NumCloseIDs: 2
-- out/run-v3/t4/stats --
Leaks:  0
Freed:  29
Reused: 29
Allocs: 0
Retain: 0

Unifications: 29
Conjuncts:    56
Disjuncts:    0
ResolveDep:   11

NumCloseIDs: 9
-- diff/-out/run-v3/t4/stats<==>+out/run/t4/stats --
diff old new
--- old
+++ new
@@ -5,9 +5,8 @@
 Retain: 0
 
 Unifications: 29
-Conjuncts:    63
-Disjuncts:    29
-
-MisalignedConjunct: 6
-
-NumCloseIDs: 2
+Conjuncts:    56
+Disjuncts:    0
+ResolveDep:   11
+
+NumCloseIDs: 9
-- out/run/t4/stats --
Leaks:  0
Freed:  29
Reused: 29
Allocs: 0
Retain: 0

Unifications: 29
Conjuncts:    63
Disjuncts:    29

MisalignedConjunct: 6

NumCloseIDs: 2
-- out/run-v3/stats/totals --
Leaks:  0
Freed:  101
Reused: 87
Allocs: 14
Retain: 0

Unifications: 101
Conjuncts:    176
Disjuncts:    0
ResolveDep:   47

NumCloseIDs: 34
-- diff/-out/run-v3/stats/totals<==>+out/run/stats/totals --
diff old new
--- old
+++ new
@@ -1,13 +1,12 @@
 Leaks:  0
 Freed:  101
-Reused: 95
-Allocs: 6
+Reused: 87
+Allocs: 14
 Retain: 0
 
 Unifications: 101
-Conjuncts:    199
-Disjuncts:    101
-
-MisalignedConjunct: 18
-
-NumCloseIDs: 8
+Conjuncts:    176
+Disjuncts:    0
+ResolveDep:   47
+
+NumCloseIDs: 34
-- out/run/stats/totals --
Leaks:  0
Freed:  101
Reused: 95
Allocs: 6
Retain: 0

Unifications: 101
Conjuncts:    199
Disjuncts:    101

MisalignedConjunct: 18

NumCloseIDs: 8
