-- in.cue --
#T: {
	config: _
	body:   _
	mas: [string]: {
		cfg:   _
		_link: #T
		link:  _link & {config: cfg}
	}
}

#a: #T & {
	config: a: int
	body: config.a
	mas: one: {
		cfg: b: config.a
		_link: {
			config: b: int
			body: config.b
			mas: two: {
				cfg: c: config.b
				_link: {
					config: c: int
					body: config.c
				}
			}
		}
	}
}

a: #a & {config: a: 34}
-- reduced.cue --
reduced: t1: {
	#T: x: y?: {
		V: _
		z: #T & V & {}
	}
	a: #T
	a: x: y: V: x: y: V: {}
}
-- out/evalalpha/stats --
Leaks:  212
Freed:  0
Reused: 0
Allocs: 212
Retain: 0

Unifications: 211
Conjuncts:    441
Disjuncts:    0

CloseIDElems: 1003
NumCloseIDs: 85
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
diff old new
--- old
+++ new
@@ -1,9 +1,12 @@
-Leaks:  0
-Freed:  120
-Reused: 107
-Allocs: 13
+Leaks:  212
+Freed:  0
+Reused: 0
+Allocs: 212
 Retain: 0
 
-Unifications: 120
-Conjuncts:    320
-Disjuncts:    120
+Unifications: 211
+Conjuncts:    441
+Disjuncts:    0
+
+CloseIDElems: 1003
+NumCloseIDs: 85
-- out/eval/stats --
Leaks:  0
Freed:  120
Reused: 107
Allocs: 13
Retain: 0

Unifications: 120
Conjuncts:    320
Disjuncts:    120
-- out/evalalpha --
(struct){
  #T: (#struct){
    config: (_){ _ }
    body: (_){ _ }
    mas: (#struct){
    }
  }
  #a: (#struct){
    config: (#struct){
      a: (int){ int }
    }
    body: (int){ int }
    mas: (#struct){
      one: (#struct){
        cfg: (#struct){
          b: (int){ int }
        }
        _link: (#struct){
          config: (#struct){
            b: (int){ int }
          }
          body: (int){ int }
          mas: (#struct){
            two: (#struct){
              cfg: (#struct){
                c: (int){ int }
              }
              _link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
              link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
            }
          }
        }
        link: (#struct){
          config: (#struct){
            b: (int){ int }
          }
          body: (int){ int }
          mas: (#struct){
            two: (#struct){
              cfg: (#struct){
                c: (int){ int }
              }
              _link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
              link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
            }
          }
        }
      }
    }
  }
  a: (#struct){
    config: (#struct){
      a: (int){ 34 }
    }
    body: (int){ 34 }
    mas: (#struct){
      one: (#struct){
        cfg: (#struct){
          b: (int){ 34 }
        }
        _link: (#struct){
          config: (#struct){
            b: (int){ int }
          }
          body: (int){ int }
          mas: (#struct){
            two: (#struct){
              cfg: (#struct){
                c: (int){ int }
              }
              _link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
              link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
            }
          }
        }
        link: (#struct){
          config: (#struct){
            b: (int){ 34 }
          }
          body: (int){ 34 }
          mas: (#struct){
            two: (#struct){
              cfg: (#struct){
                c: (int){ 34 }
              }
              _link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
              link: (#struct){
                config: (#struct){
                  c: (int){ 34 }
                }
                body: (int){ 34 }
                mas: (#struct){
                }
              }
            }
          }
        }
      }
    }
  }
  reduced: (struct){
    t1: (struct){
      #T: (#struct){
        x: (#struct){
          y?: (#struct){
            V: (_){ _ }
            z: (#struct){
              x: (#struct){
                y?: (_|_){
                  // [structural cycle]
                  V: (_){ _ }
                  z: (_|_){
                    // [structural cycle] reduced.t1.#T.x.y.z.x.y.z: structural cycle
                  }
                }
              }
            }
          }
        }
      }
      a: (#struct){
        x: (#struct){
          y: (#struct){
            V: (#struct){
              x: (struct){
                y: (struct){
                  V: (struct){
                  }
                }
              }
            }
            z: (#struct){
              x: (#struct){
                y: (#struct){
                  V: (#struct){
                  }
                  z: (#struct){
                    x: (#struct){
                      y?: (_|_){
                        // [structural cycle]
                        V: (_){ _ }
                        z: (_|_){
                          // [structural cycle] reduced.t1.a.x.y.z.x.y.z.x.y.z: structural cycle
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
+++ new
@@ -170,7 +170,7 @@
       a: (#struct){
         x: (#struct){
           y: (#struct){
-            V: (struct){
+            V: (#struct){
               x: (struct){
                 y: (struct){
                   V: (struct){
-- out/eval --
(struct){
  #T: (#struct){
    config: (_){ _ }
    body: (_){ _ }
    mas: (#struct){
    }
  }
  #a: (#struct){
    config: (#struct){
      a: (int){ int }
    }
    body: (int){ int }
    mas: (#struct){
      one: (#struct){
        cfg: (#struct){
          b: (int){ int }
        }
        _link: (#struct){
          config: (#struct){
            b: (int){ int }
          }
          body: (int){ int }
          mas: (#struct){
            two: (#struct){
              cfg: (#struct){
                c: (int){ int }
              }
              _link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
              link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
            }
          }
        }
        link: (#struct){
          config: (#struct){
            b: (int){ int }
          }
          body: (int){ int }
          mas: (#struct){
            two: (#struct){
              cfg: (#struct){
                c: (int){ int }
              }
              _link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
              link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
            }
          }
        }
      }
    }
  }
  a: (#struct){
    config: (#struct){
      a: (int){ 34 }
    }
    body: (int){ 34 }
    mas: (#struct){
      one: (#struct){
        cfg: (#struct){
          b: (int){ 34 }
        }
        _link: (#struct){
          config: (#struct){
            b: (int){ int }
          }
          body: (int){ int }
          mas: (#struct){
            two: (#struct){
              cfg: (#struct){
                c: (int){ int }
              }
              _link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
              link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
            }
          }
        }
        link: (#struct){
          config: (#struct){
            b: (int){ 34 }
          }
          body: (int){ 34 }
          mas: (#struct){
            two: (#struct){
              cfg: (#struct){
                c: (int){ 34 }
              }
              _link: (#struct){
                config: (#struct){
                  c: (int){ int }
                }
                body: (int){ int }
                mas: (#struct){
                }
              }
              link: (#struct){
                config: (#struct){
                  c: (int){ 34 }
                }
                body: (int){ 34 }
                mas: (#struct){
                }
              }
            }
          }
        }
      }
    }
  }
  reduced: (struct){
    t1: (struct){
      #T: (#struct){
        x: (#struct){
          y?: (#struct){
            V: (_){ _ }
            z: (#struct){
              x: (#struct){
                y?: (_|_){
                  // [structural cycle]
                  V: (_){ _ }
                  z: (_|_){
                    // [structural cycle] reduced.t1.#T.x.y.z.x.y.z: structural cycle
                  }
                }
              }
            }
          }
        }
      }
      a: (#struct){
        x: (#struct){
          y: (#struct){
            V: (struct){
              x: (struct){
                y: (struct){
                  V: (struct){
                  }
                }
              }
            }
            z: (#struct){
              x: (#struct){
                y: (#struct){
                  V: (#struct){
                  }
                  z: (#struct){
                    x: (#struct){
                      y?: (_|_){
                        // [structural cycle]
                        V: (_){ _ }
                        z: (_|_){
                          // [structural cycle] reduced.t1.a.x.y.z.x.y.z.x.y.z: structural cycle
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
-- out/compile --
--- in.cue
{
  #T: {
    config: _
    body: _
    mas: {
      [string]: {
        cfg: _
        _link: 〈3;#T〉
        link: (〈0;_link〉 & {
          config: 〈1;cfg〉
        })
      }
    }
  }
  #a: (〈0;#T〉 & {
    config: {
      a: int
    }
    body: 〈0;config〉.a
    mas: {
      one: {
        cfg: {
          b: 〈3;config〉.a
        }
        _link: {
          config: {
            b: int
          }
          body: 〈0;config〉.b
          mas: {
            two: {
              cfg: {
                c: 〈3;config〉.b
              }
              _link: {
                config: {
                  c: int
                }
                body: 〈0;config〉.c
              }
            }
          }
        }
      }
    }
  })
  a: (〈0;#a〉 & {
    config: {
      a: 34
    }
  })
}
--- reduced.cue
{
  reduced: {
    t1: {
      #T: {
        x: {
          y?: {
            V: _
            z: ((〈3;#T〉 & 〈0;V〉) & {})
          }
        }
      }
      a: 〈0;#T〉
      a: {
        x: {
          y: {
            V: {
              x: {
                y: {
                  V: {}
                }
              }
            }
          }
        }
      }
    }
  }
}
