-- x.cue --
// variants of fib

inline: small: {
	f: {
		n: int
		out: (f & {"n": n - 1}).out
	}
}

inline: medium: {
	f2:  (f & {n: 2}).out
	fRec: {nn: int, out: (f & {n: nn}).out}
	f: {
		n: int
		out: (fRec & {nn: n - 1}).out
	}
}

inline: patterns: {
	f: n: (f & {n: {}}).n
	f: n: {}
	[string]: {n: {}}
	f: [string]: {}
	f: {}
}

inline: acrossFields: fail1: {
	f: {
		in:  number
		out: in + 1
	}
	k00: 0
	k10: (f & {in: k00}).out
	k20: (f & {in: k10}).out
	k30: (f & {in: k20}).out

	// invalid recursion is here.
	k10: (f & {in: k30}).out
}

// Issue #2163
inline: acrossFields: ok1: {
	f: {
		in:  number
		out: in
	}
	k00: 0
	k10: (f & {in: k00}).out
	k20: (f & {in: k10}).out
	k30: (f & {in: k20}).out

	// TODO: what is correct behavior here.
	// This is borderline okay.
	k10: (f & {in: k30}).out
}
-- inlineexpand.cue --
inlined: {
	X: {
		input: a: _
		output: input.a
	}
	root: a: (X & {input: root}).output
}
expanded1: hasCycle: {
	X: {
		input: a: _
		output: input.a
	}
	root: {
		a: _a.output
		_a: X & {input: root}
	}
}
expanded2: noCycle: {
	X: {
		input: a: _
		output: input.a
	}
	root: a: _a.output
	_a: X & {input: root}
}
issue3731: reduced: {
	#lookup: {
		input: {...}
		output: [
			for _, v in input if v.show != _|_ { v },
		]
	}

	root: {
		self: show: true
		others: (#lookup & {input: root}).output
	}
}
issue3731: expanded: {
	#lookup: {
		input: {...}
		output: [
			for _, v in input if v.show != _|_ { v },
		]
	}

	root: {
		self: show: true
		others: _others.output
		_others: #lookup & {input: root}
	}
}
issue3731: full: {
	#Workspace: {
		workspaceA?: {}
		workspaceB?: {}
	}

	#AccountConfig: {
		workspaces: #Workspace
		siblings?: [...string]
	}

	#AccountConfigSub1: {
		#AccountConfig
		workspaces: "workspaceA": {}
	}
	
	#AccountConfigSub2: {
		#AccountConfig
		workspaces: "workspaceB": {}
	}
	
	tree: env1: {
		"region1": {
			"env1-r1-account-sub1": #AccountConfigSub1
			"env1-r1-account-sub2-1": #AccountConfigSub2
		}
	}
	
	#lookupSiblings: {
		envtree: {...}
		out: [
			for region, v in envtree
			for account, config in v
			if config.workspaces."workspaceB" != _|_ { account },
		]
	}
	
	tree: ENVTREE=env1: [_]: [_]: #AccountConfig & {
		siblings: (#lookupSiblings & {envtree: ENVTREE}).out
	}
}
-- out/compile --
--- inlineexpand.cue
{
  inlined: {
    X: {
      input: {
        a: _
      }
      output: 〈0;input〉.a
    }
    root: {
      a: (〈1;X〉 & {
        input: 〈2;root〉
      }).output
    }
  }
  expanded1: {
    hasCycle: {
      X: {
        input: {
          a: _
        }
        output: 〈0;input〉.a
      }
      root: {
        a: 〈0;_a〉.output
        _a: (〈1;X〉 & {
          input: 〈2;root〉
        })
      }
    }
  }
  expanded2: {
    noCycle: {
      X: {
        input: {
          a: _
        }
        output: 〈0;input〉.a
      }
      root: {
        a: 〈1;_a〉.output
      }
      _a: (〈0;X〉 & {
        input: 〈1;root〉
      })
    }
  }
  issue3731: {
    reduced: {
      #lookup: {
        input: {
          ...
        }
        output: [
          for _, v in 〈1;input〉 if (〈0;v〉.show != _|_(explicit error (_|_ literal) in source)) {
            〈1;v〉
          },
        ]
      }
      root: {
        self: {
          show: true
        }
        others: (〈1;#lookup〉 & {
          input: 〈2;root〉
        }).output
      }
    }
  }
  issue3731: {
    expanded: {
      #lookup: {
        input: {
          ...
        }
        output: [
          for _, v in 〈1;input〉 if (〈0;v〉.show != _|_(explicit error (_|_ literal) in source)) {
            〈1;v〉
          },
        ]
      }
      root: {
        self: {
          show: true
        }
        others: 〈0;_others〉.output
        _others: (〈1;#lookup〉 & {
          input: 〈2;root〉
        })
      }
    }
  }
  issue3731: {
    full: {
      #Workspace: {
        workspaceA?: {}
        workspaceB?: {}
      }
      #AccountConfig: {
        workspaces: 〈1;#Workspace〉
        siblings?: [
          ...string,
        ]
      }
      #AccountConfigSub1: {
        〈1;#AccountConfig〉
        workspaces: {
          workspaceA: {}
        }
      }
      #AccountConfigSub2: {
        〈1;#AccountConfig〉
        workspaces: {
          workspaceB: {}
        }
      }
      tree: {
        env1: {
          region1: {
            "env1-r1-account-sub1": 〈3;#AccountConfigSub1〉
            "env1-r1-account-sub2-1": 〈3;#AccountConfigSub2〉
          }
        }
      }
      #lookupSiblings: {
        envtree: {
          ...
        }
        out: [
          for region, v in 〈1;envtree〉 for account, config in 〈0;v〉 if (〈0;config〉.workspaces.workspaceB != _|_(explicit error (_|_ literal) in source)) {
            〈1;account〉
          },
        ]
      }
      tree: {
        env1: {
          [_]: {
            [_]: (〈3;#AccountConfig〉 & {
              siblings: (〈4;#lookupSiblings〉 & {
                envtree: 〈4;env1〉
              }).out
            })
          }
        }
      }
    }
  }
}
--- x.cue
{
  inline: {
    small: {
      f: {
        n: int
        out: (〈1;f〉 & {
          n: (〈1;n〉 - 1)
        }).out
      }
    }
  }
  inline: {
    medium: {
      f2: (〈0;f〉 & {
        n: 2
      }).out
      fRec: {
        nn: int
        out: (〈1;f〉 & {
          n: 〈1;nn〉
        }).out
      }
      f: {
        n: int
        out: (〈1;fRec〉 & {
          nn: (〈1;n〉 - 1)
        }).out
      }
    }
  }
  inline: {
    patterns: {
      f: {
        n: (〈1;f〉 & {
          n: {}
        }).n
      }
      f: {
        n: {}
      }
      [string]: {
        n: {}
      }
      f: {
        [string]: {}
      }
      f: {}
    }
  }
  inline: {
    acrossFields: {
      fail1: {
        f: {
          in: number
          out: (〈0;in〉 + 1)
        }
        k00: 0
        k10: (〈0;f〉 & {
          in: 〈1;k00〉
        }).out
        k20: (〈0;f〉 & {
          in: 〈1;k10〉
        }).out
        k30: (〈0;f〉 & {
          in: 〈1;k20〉
        }).out
        k10: (〈0;f〉 & {
          in: 〈1;k30〉
        }).out
      }
    }
  }
  inline: {
    acrossFields: {
      ok1: {
        f: {
          in: number
          out: 〈0;in〉
        }
        k00: 0
        k10: (〈0;f〉 & {
          in: 〈1;k00〉
        }).out
        k20: (〈0;f〉 & {
          in: 〈1;k10〉
        }).out
        k30: (〈0;f〉 & {
          in: 〈1;k20〉
        }).out
        k10: (〈0;f〉 & {
          in: 〈1;k30〉
        }).out
      }
    }
  }
}
-- out/evalalpha/stats --
Leaks:  344
Freed:  0
Reused: 0
Allocs: 344
Retain: 0

Unifications: 269
Conjuncts:    675
Disjuncts:    0

CloseIDElems: 329
NumCloseIDs: 233
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
diff old new
--- old
+++ new
@@ -1,9 +1,12 @@
-Leaks:  286
-Freed:  253
-Reused: 248
-Allocs: 291
-Retain: 994
-
-Unifications: 539
-Conjuncts:    1663
-Disjuncts:    943
+Leaks:  344
+Freed:  0
+Reused: 0
+Allocs: 344
+Retain: 0
+
+Unifications: 269
+Conjuncts:    675
+Disjuncts:    0
+
+CloseIDElems: 329
+NumCloseIDs: 233
-- out/eval/stats --
Leaks:  286
Freed:  253
Reused: 248
Allocs: 291
Retain: 994

Unifications: 539
Conjuncts:    1663
Disjuncts:    943
-- out/eval --
Errors:
expanded1.hasCycle.root._a.input._a.input: structural cycle:
    ./inlineexpand.cue:11:11
issue3731.expanded.root._others.input._others.input: structural cycle:
    ./inlineexpand.cue:43:16
structural cycle:
    ./x.cue:6:9
structural cycle:
    ./x.cue:15:9
structural cycle:
    ./x.cue:20:9
in: structural cycle:
    ./x.cue:30:8

Result:
(_|_){
  // [structural cycle]
  inlined: (struct){
    X: (struct){
      input: (struct){
        a: (_){ _ }
      }
      output: (_){ _ }
    }
    root: (struct){
      a: (_){ _ }
    }
  }
  expanded1: (_|_){
    // [structural cycle]
    hasCycle: (_|_){
      // [structural cycle]
      X: (struct){
        input: (struct){
          a: (_){ _ }
        }
        output: (_){ _ }
      }
      root: (_|_){
        // [structural cycle]
        a: (_){ _ }
        _a: (_|_){
          // [structural cycle]
          input: (_|_){
            // [structural cycle]
            a: (_|_){
              // [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle:
              //     ./inlineexpand.cue:11:11
            }
            _a: (_|_){
              // [structural cycle]
              input: (_|_){
                // [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle:
                //     ./inlineexpand.cue:11:11
              }
              output: (_|_){
                // [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle:
                //     ./inlineexpand.cue:11:11
              }
            }
          }
          output: (_|_){
            // [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle:
            //     ./inlineexpand.cue:11:11
          }
        }
      }
    }
  }
  expanded2: (struct){
    noCycle: (struct){
      X: (struct){
        input: (struct){
          a: (_){ _ }
        }
        output: (_){ _ }
      }
      root: (struct){
        a: (_){ _ }
      }
      _a: (struct){
        input: (struct){
          a: (_){ _ }
        }
        output: (_){ _ }
      }
    }
  }
  issue3731: (_|_){
    // [structural cycle]
    reduced: (struct){
      #lookup: (#struct){
        input: (#struct){
        }
        output: (#list){
        }
      }
      root: (struct){
        self: (struct){
          show: (bool){ true }
        }
        others: (#list){
          0: (struct){
            show: (bool){ true }
          }
        }
      }
    }
    expanded: (_|_){
      // [structural cycle]
      #lookup: (#struct){
        input: (#struct){
        }
        output: (#list){
        }
      }
      root: (_|_){
        // [structural cycle]
        self: (struct){
          show: (bool){ true }
        }
        others: (#list){
          0: (struct){
            show: (bool){ true }
          }
        }
        _others: (_|_){
          // [structural cycle]
          input: (_|_){
            // [structural cycle]
            self: (struct){
              show: (bool){ true }
            }
            others: (_|_){
              // [structural cycle] issue3731.expanded.root._others.input._others.input: structural cycle:
              //     ./inlineexpand.cue:43:16
            }
            _others: (_|_){
              // [structural cycle]
              input: (_|_){
                // [structural cycle] issue3731.expanded.root._others.input._others.input: structural cycle:
                //     ./inlineexpand.cue:43:16
              }
              output: (_|_){
                // [structural cycle] issue3731.expanded.root._others.input._others.input: structural cycle:
                //     ./inlineexpand.cue:43:16
              }
            }
          }
          output: (#list){
            0: (#struct){
              show: (bool){ true }
            }
          }
        }
      }
    }
    full: (struct){
      #Workspace: (#struct){
        workspaceA?: (#struct){
        }
        workspaceB?: (#struct){
        }
      }
      #AccountConfig: (#struct){
        workspaces: (#struct){
          workspaceA?: (#struct){
          }
          workspaceB?: (#struct){
          }
        }
        siblings?: (list){
        }
      }
      #AccountConfigSub1: (#struct){
        workspaces: (#struct){
          workspaceA: (#struct){
          }
          workspaceB?: (#struct){
          }
        }
        siblings?: (list){
        }
      }
      #AccountConfigSub2: (#struct){
        workspaces: (#struct){
          workspaceA?: (#struct){
          }
          workspaceB: (#struct){
          }
        }
        siblings?: (list){
        }
      }
      tree: (struct){
        env1: (struct){
          region1: (struct){
            "env1-r1-account-sub1": (#struct){
              workspaces: (#struct){
                workspaceA: (#struct){
                }
                workspaceB?: (#struct){
                }
              }
              siblings: (#list){
                0: (string){ "env1-r1-account-sub2-1" }
              }
            }
            "env1-r1-account-sub2-1": (#struct){
              workspaces: (#struct){
                workspaceA?: (#struct){
                }
                workspaceB: (#struct){
                }
              }
              siblings: (#list){
                0: (string){ "env1-r1-account-sub2-1" }
              }
            }
          }
        }
      }
      #lookupSiblings: (#struct){
        envtree: (#struct){
        }
        out: (#list){
        }
      }
    }
  }
  inline: (_|_){
    // [structural cycle]
    small: (_|_){
      // [structural cycle]
      f: (_|_){
        // [structural cycle]
        n: (int){ int }
        out: (_|_){
          // [structural cycle] structural cycle:
          //     ./x.cue:6:9
        }
      }
    }
    medium: (_|_){
      // [structural cycle]
      f2: (_|_){
        // [structural cycle] structural cycle:
        //     ./x.cue:15:9
      }
      fRec: (_|_){
        // [structural cycle]
        nn: (int){ int }
        out: (_|_){
          // [structural cycle] structural cycle:
          //     ./x.cue:15:9
        }
      }
      f: (_|_){
        // [structural cycle]
        n: (int){ int }
        out: (_|_){
          // [structural cycle] structural cycle:
          //     ./x.cue:15:9
        }
      }
    }
    patterns: (_|_){
      // [structural cycle]
      f: (_|_){
        // [structural cycle]
        n: (_|_){
          // [structural cycle] structural cycle:
          //     ./x.cue:20:9
        }
      }
    }
    acrossFields: (_|_){
      // [structural cycle]
      fail1: (_|_){
        // [structural cycle]
        f: (struct){
          in: (number){ number }
          out: (_|_){
            // [incomplete] inline.acrossFields.fail1.f.out: non-concrete value number in operand to +:
            //     ./x.cue:30:8
            //     ./x.cue:29:8
          }
        }
        k00: (int){ 0 }
        k10: (_|_){
          // [structural cycle] in: structural cycle:
          //     ./x.cue:30:8
        }
        k20: (_|_){
          // [structural cycle] in: structural cycle:
          //     ./x.cue:30:8
        }
        k30: (_|_){
          // [structural cycle] in: structural cycle:
          //     ./x.cue:30:8
        }
      }
      ok1: (struct){
        f: (struct){
          in: (number){ number }
          out: (number){ number }
        }
        k00: (int){ 0 }
        k10: (int){ 0 }
        k20: (int){ 0 }
        k30: (int){ 0 }
      }
    }
  }
}
-- out/evalalpha --
Errors:
expanded1.hasCycle.root._a.input._a.input: structural cycle
issue3731.expanded.root._others.input._others.input: structural cycle
structural cycle:
    ./x.cue:6:9
structural cycle:
    ./x.cue:12:24
structural cycle:
    ./x.cue:15:9
structural cycle:
    ./x.cue:20:9

Result:
(_|_){
  // [structural cycle]
  inlined: (struct){
    X: (struct){
      input: (struct){
        a: (_){ _ }
      }
      output: (_){ _ }
    }
    root: (struct){
      a: (_){ _ }
    }
  }
  expanded1: (_|_){
    // [structural cycle]
    hasCycle: (_|_){
      // [structural cycle]
      X: (struct){
        input: (struct){
          a: (_){ _ }
        }
        output: (_){ _ }
      }
      root: (_|_){
        // [structural cycle]
        a: (_){ _ }
        _a: (_|_){
          // [structural cycle]
          input: (_|_){
            // [structural cycle]
            a: (_){ _ }
            _a: (_|_){
              // [structural cycle]
              input: (_|_){
                // [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle
              }
              output: (_|_){
                // [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle
              }
            }
          }
          output: (_){ _ }
        }
      }
    }
  }
  expanded2: (struct){
    noCycle: (struct){
      X: (struct){
        input: (struct){
          a: (_){ _ }
        }
        output: (_){ _ }
      }
      root: (struct){
        a: (_){ _ }
      }
      _a: (struct){
        input: (struct){
          a: (_){ _ }
        }
        output: (_){ _ }
      }
    }
  }
  issue3731: (_|_){
    // [structural cycle]
    reduced: (struct){
      #lookup: (#struct){
        input: (#struct){
        }
        output: (#list){
        }
      }
      root: (struct){
        self: (struct){
          show: (bool){ true }
        }
        others: (#list){
          0: (#struct){
            show: (bool){ true }
          }
        }
      }
    }
    expanded: (_|_){
      // [structural cycle]
      #lookup: (#struct){
        input: (#struct){
        }
        output: (#list){
        }
      }
      root: (_|_){
        // [structural cycle]
        self: (struct){
          show: (bool){ true }
        }
        others: ~(issue3731.expanded.root._others.output)
        _others: (_|_){
          // [structural cycle]
          input: (_|_){
            // [structural cycle]
            self: (#struct){
              show: (bool){ true }
            }
            others: (#list){
            }
            _others: (_|_){
              // [structural cycle]
              input: (_|_){
                // [structural cycle] issue3731.expanded.root._others.input._others.input: structural cycle
              }
              output: (#list){
              }
            }
          }
          output: (#list){
            0: (#struct){
              show: (bool){ true }
            }
          }
        }
      }
    }
    full: (struct){
      #Workspace: (#struct){
        workspaceA?: (#struct){
        }
        workspaceB?: (#struct){
        }
      }
      #AccountConfig: (#struct){
        workspaces: ~(issue3731.full.#Workspace)
        siblings?: (list){
        }
      }
      #AccountConfigSub1: (#struct){
        workspaces: (#struct){
          workspaceA: (#struct){
          }
          workspaceB?: (#struct){
          }
        }
        siblings?: (list){
        }
      }
      #AccountConfigSub2: (#struct){
        workspaces: (#struct){
          workspaceB: (#struct){
          }
          workspaceA?: (#struct){
          }
        }
        siblings?: (list){
        }
      }
      tree: (struct){
        env1: (struct){
          region1: (struct){
            "env1-r1-account-sub1": (#struct){
              siblings: (#list){
                0: (string){ "env1-r1-account-sub2-1" }
              }
              workspaces: (#struct){
                workspaceA: (#struct){
                }
                workspaceB?: (#struct){
                }
              }
            }
            "env1-r1-account-sub2-1": (#struct){
              siblings: (#list){
                0: (string){ "env1-r1-account-sub2-1" }
              }
              workspaces: (#struct){
                workspaceB: (#struct){
                }
                workspaceA?: (#struct){
                }
              }
            }
          }
        }
      }
      #lookupSiblings: (#struct){
        envtree: (#struct){
        }
        out: (#list){
        }
      }
    }
  }
  inline: (_|_){
    // [structural cycle]
    small: (_|_){
      // [structural cycle]
      f: (_|_){
        // [structural cycle]
        n: (int){ int }
        out: (_|_){
          // [structural cycle] structural cycle:
          //     ./x.cue:6:9
        }
      }
    }
    medium: (_|_){
      // [structural cycle]
      f2: (_|_){
        // [structural cycle] structural cycle:
        //     ./x.cue:12:24
      }
      fRec: (_|_){
        // [structural cycle]
        nn: (int){ int }
        out: (_|_){
          // [structural cycle] structural cycle:
          //     ./x.cue:15:9
        }
      }
      f: (_|_){
        // [structural cycle]
        n: (int){ int }
        out: (_|_){
          // [structural cycle] structural cycle:
          //     ./x.cue:15:9
        }
      }
    }
    patterns: (_|_){
      // [structural cycle]
      f: (_|_){
        // [structural cycle]
        n: (_|_){
          // [structural cycle] structural cycle:
          //     ./x.cue:20:9
        }
      }
    }
    acrossFields: (struct){
      fail1: (struct){
        f: (struct){
          in: (number){ number }
          out: (_|_){
            // [incomplete] inline.acrossFields.fail1.f.out: non-concrete value number in operand to +:
            //     ./x.cue:30:8
            //     ./x.cue:29:8
          }
        }
        k00: (int){ 0 }
        k10: (_|_){
          // [incomplete] in: non-concrete value number in operand to +:
          //     ./x.cue:30:8
          //     ./x.cue:29:8
          //     ./x.cue:35:17
        }
        k20: (_|_){
          // [incomplete] in: non-concrete value number in operand to +:
          //     ./x.cue:30:8
          //     ./x.cue:29:8
          //     ./x.cue:38:17
        }
        k30: (_|_){
          // [incomplete] in: non-concrete value number in operand to +:
          //     ./x.cue:30:8
          //     ./x.cue:29:8
          //     ./x.cue:34:17
        }
      }
      ok1: (struct){
        f: (struct){
          in: (number){ number }
          out: (number){ number }
        }
        k00: (int){ 0 }
        k10: (int){ 0 }
        k20: (int){ 0 }
        k30: (int){ 0 }
      }
    }
  }
}
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
+++ new
@@ -1,16 +1,14 @@
 Errors:
-expanded1.hasCycle.root._a.input._a.input: structural cycle:
-    ./inlineexpand.cue:11:11
-issue3731.expanded.root._others.input._others.input: structural cycle:
-    ./inlineexpand.cue:43:16
+expanded1.hasCycle.root._a.input._a.input: structural cycle
+issue3731.expanded.root._others.input._others.input: structural cycle
 structural cycle:
     ./x.cue:6:9
 structural cycle:
+    ./x.cue:12:24
+structural cycle:
     ./x.cue:15:9
 structural cycle:
     ./x.cue:20:9
-in: structural cycle:
-    ./x.cue:30:8
 
 Result:
 (_|_){
@@ -43,26 +41,18 @@
           // [structural cycle]
           input: (_|_){
             // [structural cycle]
-            a: (_|_){
-              // [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle:
-              //     ./inlineexpand.cue:11:11
-            }
+            a: (_){ _ }
             _a: (_|_){
               // [structural cycle]
               input: (_|_){
-                // [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle:
-                //     ./inlineexpand.cue:11:11
-              }
-              output: (_|_){
-                // [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle:
-                //     ./inlineexpand.cue:11:11
-              }
-            }
-          }
-          output: (_|_){
-            // [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle:
-            //     ./inlineexpand.cue:11:11
-          }
+                // [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle
+              }
+              output: (_|_){
+                // [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle
+              }
+            }
+          }
+          output: (_){ _ }
         }
       }
     }
@@ -100,7 +90,7 @@
           show: (bool){ true }
         }
         others: (#list){
-          0: (struct){
+          0: (#struct){
             show: (bool){ true }
           }
         }
@@ -119,31 +109,22 @@
         self: (struct){
           show: (bool){ true }
         }
-        others: (#list){
-          0: (struct){
-            show: (bool){ true }
-          }
-        }
+        others: ~(issue3731.expanded.root._others.output)
         _others: (_|_){
           // [structural cycle]
           input: (_|_){
             // [structural cycle]
-            self: (struct){
-              show: (bool){ true }
-            }
-            others: (_|_){
-              // [structural cycle] issue3731.expanded.root._others.input._others.input: structural cycle:
-              //     ./inlineexpand.cue:43:16
+            self: (#struct){
+              show: (bool){ true }
+            }
+            others: (#list){
             }
             _others: (_|_){
               // [structural cycle]
               input: (_|_){
-                // [structural cycle] issue3731.expanded.root._others.input._others.input: structural cycle:
-                //     ./inlineexpand.cue:43:16
-              }
-              output: (_|_){
-                // [structural cycle] issue3731.expanded.root._others.input._others.input: structural cycle:
-                //     ./inlineexpand.cue:43:16
+                // [structural cycle] issue3731.expanded.root._others.input._others.input: structural cycle
+              }
+              output: (#list){
               }
             }
           }
@@ -163,12 +144,7 @@
         }
       }
       #AccountConfig: (#struct){
-        workspaces: (#struct){
-          workspaceA?: (#struct){
-          }
-          workspaceB?: (#struct){
-          }
-        }
+        workspaces: ~(issue3731.full.#Workspace)
         siblings?: (list){
         }
       }
@@ -184,10 +160,10 @@
       }
       #AccountConfigSub2: (#struct){
         workspaces: (#struct){
-          workspaceA?: (#struct){
-          }
           workspaceB: (#struct){
           }
+          workspaceA?: (#struct){
+          }
         }
         siblings?: (list){
         }
@@ -196,6 +172,9 @@
         env1: (struct){
           region1: (struct){
             "env1-r1-account-sub1": (#struct){
+              siblings: (#list){
+                0: (string){ "env1-r1-account-sub2-1" }
+              }
               workspaces: (#struct){
                 workspaceA: (#struct){
                 }
@@ -202,19 +181,16 @@
                 workspaceB?: (#struct){
                 }
               }
-              siblings: (#list){
-                0: (string){ "env1-r1-account-sub2-1" }
-              }
             }
             "env1-r1-account-sub2-1": (#struct){
-              workspaces: (#struct){
-                workspaceA?: (#struct){
-                }
+              siblings: (#list){
+                0: (string){ "env1-r1-account-sub2-1" }
+              }
+              workspaces: (#struct){
                 workspaceB: (#struct){
                 }
-              }
-              siblings: (#list){
-                0: (string){ "env1-r1-account-sub2-1" }
+                workspaceA?: (#struct){
+                }
               }
             }
           }
@@ -245,7 +221,7 @@
       // [structural cycle]
       f2: (_|_){
         // [structural cycle] structural cycle:
-        //     ./x.cue:15:9
+        //     ./x.cue:12:24
       }
       fRec: (_|_){
         // [structural cycle]
@@ -274,10 +250,8 @@
         }
       }
     }
-    acrossFields: (_|_){
-      // [structural cycle]
-      fail1: (_|_){
-        // [structural cycle]
+    acrossFields: (struct){
+      fail1: (struct){
         f: (struct){
           in: (number){ number }
           out: (_|_){
@@ -288,16 +262,22 @@
         }
         k00: (int){ 0 }
         k10: (_|_){
-          // [structural cycle] in: structural cycle:
-          //     ./x.cue:30:8
+          // [incomplete] in: non-concrete value number in operand to +:
+          //     ./x.cue:30:8
+          //     ./x.cue:29:8
+          //     ./x.cue:35:17
         }
         k20: (_|_){
-          // [structural cycle] in: structural cycle:
-          //     ./x.cue:30:8
+          // [incomplete] in: non-concrete value number in operand to +:
+          //     ./x.cue:30:8
+          //     ./x.cue:29:8
+          //     ./x.cue:38:17
         }
         k30: (_|_){
-          // [structural cycle] in: structural cycle:
-          //     ./x.cue:30:8
+          // [incomplete] in: non-concrete value number in operand to +:
+          //     ./x.cue:30:8
+          //     ./x.cue:29:8
+          //     ./x.cue:34:17
         }
       }
       ok1: (struct){
-- diff/todo/p2 --
One test now fails. Given TODO, this may be okay.
This does break Issue #2163.
