#IgnoreConcrete: true
#InferTasks: true
-- in.cue --
package p

import (
	"list"
	"tool/cli"
)

root: test: cli.Print & { text: "\(len(list.FlattenN(indir1, 10)))" }

indir1: [if len(indir2) > 0 { indir2 }]
indir2: [if len(indir3) > 0 { indir3 }]
indir3: [if len(indir4) > 0 { indir4 }]
indir4: indir5
indir5: indir6
indir6: indir7
indir7: [for i in list.Range(1,20,4) {
	#pair & {
		one: n: 0
		two: n: i
	}
}]

#pair: {
	one: #unit & {
		n: <25
	}
	two: #unit & {
		n: >=one.n
		if n == one.n {
			n: <= one.n
		}
	}
	if two.n > one.n {
		one: n: 0
	}
}

#unit: {
	n: int
	#padding: {in: <10, out: "0\(in)"} | {in: >=10, out: "\(in)"}
	str: (#padding & {in: n}).out
}
-- out/run/errors --
-- out/run/t0 --
graph TD
  t0("root.test [Ready]")

-- out/run/t1 --
graph TD
  t0("root.test [Terminated]")

-- out/run/t1/value --
{
	$id:    "tool/cli.Print"
	stdout: "foo"
	text:   "5"
}
-- out/run-v3/t1/stats --
Leaks:  124
Freed:  709
Reused: 685
Allocs: 148
Retain: 0

Unifications: 565
Conjuncts:    1661
Disjuncts:    178
ResolveDep:   246

NumCloseIDs: 381
-- diff/-out/run-v3/t1/stats<==>+out/run/t1/stats --
diff old new
--- old
+++ new
@@ -1,11 +1,12 @@
-Leaks:  0
-Freed:  25577
-Reused: 25557
-Allocs: 20
-Retain: 337
-
-Unifications: 18345
-Conjuncts:    76395
-Disjuncts:    25826
-
-NumCloseIDs: 72
+Leaks:  124
+Freed:  709
+Reused: 685
+Allocs: 148
+Retain: 0
+
+Unifications: 565
+Conjuncts:    1661
+Disjuncts:    178
+ResolveDep:   246
+
+NumCloseIDs: 381
-- out/run/t1/stats --
Leaks:  0
Freed:  25577
Reused: 25557
Allocs: 20
Retain: 337

Unifications: 18345
Conjuncts:    76395
Disjuncts:    25826

NumCloseIDs: 72
-- out/run-v3/stats/totals --
Leaks:  124
Freed:  709
Reused: 685
Allocs: 148
Retain: 0

Unifications: 565
Conjuncts:    1661
Disjuncts:    178
ResolveDep:   246

NumCloseIDs: 381
-- diff/-out/run-v3/stats/totals<==>+out/run/stats/totals --
diff old new
--- old
+++ new
@@ -1,11 +1,12 @@
-Leaks:  0
-Freed:  25577
-Reused: 25557
-Allocs: 20
-Retain: 337
-
-Unifications: 18345
-Conjuncts:    76395
-Disjuncts:    25826
-
-NumCloseIDs: 72
+Leaks:  124
+Freed:  709
+Reused: 685
+Allocs: 148
+Retain: 0
+
+Unifications: 565
+Conjuncts:    1661
+Disjuncts:    178
+ResolveDep:   246
+
+NumCloseIDs: 381
-- out/run/stats/totals --
Leaks:  0
Freed:  25577
Reused: 25557
Allocs: 20
Retain: 337

Unifications: 18345
Conjuncts:    76395
Disjuncts:    25826

NumCloseIDs: 72
