raw: true
eval: true
-- in.cue --
{
	#Foo: {
		sgl:  #Bar
		ref:  null | #Foo
		ext:  #Bar | null
		ref:  null | #Foo
		ref2: null | #Foo.sgl
		...
	}
	#Foo: {
		"#Foo": 2
		...
	}
	#Bar: string
}
-- out/def --
#Foo: {
	"#Foo": 2
	sgl:    #Bar
	ref:    (null | #Foo) & (null | #Foo)
	ext:    #Bar | null
	ref2:   null | #Foo.sgl
	...
}
#Bar: string
-- out/export --

-- out/yaml --
{}
-- out/json --
{}
-- out/compile --
--- in.cue
{
  {
    #Foo: {
      sgl: 〈1;#Bar〉
      ref: (null|〈1;#Foo〉)
      ext: (〈1;#Bar〉|null)
      ref: (null|〈1;#Foo〉)
      ref2: (null|〈1;#Foo〉.sgl)
      ...
    }
    #Foo: {
      "#Foo": 2
      ...
    }
    #Bar: string
  }
}
-- out/evalalpha/stats --
Leaks:  23
Freed:  0
Reused: 0
Allocs: 23
Retain: 0

Unifications: 8
Conjuncts:    25
Disjuncts:    10

CloseIDElems: 0
NumCloseIDs: 4
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
diff old new
--- old
+++ new
@@ -1,9 +1,12 @@
-Leaks:  0
-Freed:  70
-Reused: 59
-Allocs: 11
-Retain: 1
-
-Unifications: 28
-Conjuncts:    131
-Disjuncts:    71
+Leaks:  23
+Freed:  0
+Reused: 0
+Allocs: 23
+Retain: 0
+
+Unifications: 8
+Conjuncts:    25
+Disjuncts:    10
+
+CloseIDElems: 0
+NumCloseIDs: 4
-- out/eval/stats --
Leaks:  0
Freed:  70
Reused: 59
Allocs: 11
Retain: 1

Unifications: 28
Conjuncts:    131
Disjuncts:    71
-- 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 }
}
