raw: true
eval: true
#inlinetest:exclude skip — tests export format, not evaluator semantics
-- in.cue --
{
	#Foo: {
		sgl:  #Bar
		ref:  null | #Foo
		ext:  #Bar | null
		ref:  null | #Foo
		ref2: null | #Foo.sgl
		...
	}
	#Foo: {
		"#Foo": 2
		...
	}
	#Bar: string
}
-- out/eval/stats --
Leaks:  1
Freed:  22
Reused: 6
Allocs: 17
Retain: 0

Unifications: 8
Conjuncts:    25
Disjuncts:    10

NumCloseIDs: 4
-- out/evalalpha --
(struct){
  #Foo: (#struct){
    sgl: (string){ string }
    ref: (null){ null }
    ext: ((null|string)){ |((string){ string }, (null){ null }) }
    ref2: ((null|string)){ |((null){ null }, (string){ string }) }
    "#Foo": (int){ 2 }
  }
  #Bar: (string){ string }
}
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
+++ new
@@ -1,13 +1,7 @@
 (struct){
   #Foo: (#struct){
     sgl: (string){ string }
-    ref: ((null|struct)){ |((null){ null }, (#struct){
-        sgl: (string){ string }
-        ref: (null){ null }
-        ext: ((null|string)){ |((string){ string }, (null){ null }) }
-        ref2: ((null|string)){ |((null){ null }, (string){ string }) }
-        "#Foo": (int){ 2 }
-      }) }
+    ref: (null){ null }
     ext: ((null|string)){ |((string){ string }, (null){ null }) }
     ref2: ((null|string)){ |((null){ null }, (string){ string }) }
     "#Foo": (int){ 2 }
-- diff/todo/p2 --
Structural cycle eliminated too soon?
-- out/eval --
(struct){
  #Foo: (#struct){
    sgl: (string){ string }
    ref: ((null|struct)){ |((null){ null }, (#struct){
        sgl: (string){ string }
        ref: (null){ null }
        ext: ((null|string)){ |((string){ string }, (null){ null }) }
        ref2: ((null|string)){ |((null){ null }, (string){ string }) }
        "#Foo": (int){ 2 }
      }) }
    ext: ((null|string)){ |((string){ string }, (null){ null }) }
    ref2: ((null|string)){ |((null){ null }, (string){ string }) }
    "#Foo": (int){ 2 }
  }
  #Bar: (string){ string }
}
