// Issue #3527
// This code caused a panic before.
-- in.cue --
package p

_taxPayer: self: {}

let sam = {taxPayer: _taxPayer}
assert: {
	invoke: sam
	invoke: _
	res: subject & {in: invoke}
}

subject: {
	in: #ReturnData
	_computed: (#computeF1040 & {"in": in})
}
#computeF1040: in:      #ReturnData
#ReturnData: taxPayer?: #TaxPayer
#TaxPayer: self?:       _
-- out/eval/stats --
Leaks:  0
Freed:  35
Reused: 26
Allocs: 9
Retain: 4

Unifications: 35
Conjuncts:    82
Disjuncts:    39
-- out/evalalpha --
(struct){
  _taxPayer(:p): (struct){
    self: (struct){
    }
  }
  let sam#1 = (struct){
    taxPayer: ~(_taxPayer(:p))
  }
  assert: (struct){
    invoke: (struct){
      taxPayer: ~(_taxPayer(:p))
    }
    res: (struct){
      in: (#struct){
        taxPayer: (#struct){
          self: (#struct){
          }
        }
      }
      _computed(:p): (#struct){
        in: (#struct){
          taxPayer: (#struct){
            self: (#struct){
            }
          }
        }
      }
    }
  }
  subject: (struct){
    in: ~(#ReturnData)
    _computed(:p): (#struct){
      in: ~(#ReturnData)
    }
  }
  #computeF1040: (#struct){
    in: ~(#ReturnData)
  }
  #ReturnData: (#struct){
    taxPayer?: ~(#TaxPayer)
  }
  #TaxPayer: (#struct){
    self?: (_){ _ }
  }
}
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
+++ new
@@ -4,22 +4,16 @@
     }
   }
   let sam#1 = (struct){
-    taxPayer: (struct){
-      self: (struct){
-      }
-    }
+    taxPayer: ~(_taxPayer(:p))
   }
   assert: (struct){
     invoke: (struct){
-      taxPayer: (struct){
-        self: (struct){
-        }
-      }
+      taxPayer: ~(_taxPayer(:p))
     }
     res: (struct){
       in: (#struct){
         taxPayer: (#struct){
-          self: (struct){
+          self: (#struct){
           }
         }
       }
@@ -26,7 +20,7 @@
       _computed(:p): (#struct){
         in: (#struct){
           taxPayer: (#struct){
-            self: (struct){
+            self: (#struct){
             }
           }
         }
@@ -34,30 +28,16 @@
     }
   }
   subject: (struct){
-    in: (#struct){
-      taxPayer?: (#struct){
-        self?: (_){ _ }
-      }
-    }
+    in: ~(#ReturnData)
     _computed(:p): (#struct){
-      in: (#struct){
-        taxPayer?: (#struct){
-          self?: (_){ _ }
-        }
-      }
+      in: ~(#ReturnData)
     }
   }
   #computeF1040: (#struct){
-    in: (#struct){
-      taxPayer?: (#struct){
-        self?: (_){ _ }
-      }
-    }
+    in: ~(#ReturnData)
   }
   #ReturnData: (#struct){
-    taxPayer?: (#struct){
-      self?: (_){ _ }
-    }
+    taxPayer?: ~(#TaxPayer)
   }
   #TaxPayer: (#struct){
     self?: (_){ _ }
-- out/eval --
(struct){
  _taxPayer(:p): (struct){
    self: (struct){
    }
  }
  let sam#1 = (struct){
    taxPayer: (struct){
      self: (struct){
      }
    }
  }
  assert: (struct){
    invoke: (struct){
      taxPayer: (struct){
        self: (struct){
        }
      }
    }
    res: (struct){
      in: (#struct){
        taxPayer: (#struct){
          self: (struct){
          }
        }
      }
      _computed(:p): (#struct){
        in: (#struct){
          taxPayer: (#struct){
            self: (struct){
            }
          }
        }
      }
    }
  }
  subject: (struct){
    in: (#struct){
      taxPayer?: (#struct){
        self?: (_){ _ }
      }
    }
    _computed(:p): (#struct){
      in: (#struct){
        taxPayer?: (#struct){
          self?: (_){ _ }
        }
      }
    }
  }
  #computeF1040: (#struct){
    in: (#struct){
      taxPayer?: (#struct){
        self?: (_){ _ }
      }
    }
  }
  #ReturnData: (#struct){
    taxPayer?: (#struct){
      self?: (_){ _ }
    }
  }
  #TaxPayer: (#struct){
    self?: (_){ _ }
  }
}
-- out/compile --
--- in.cue
{
  _taxPayer: {
    self: {}
  }
  let sam#1 = {
    taxPayer: 〈1;_taxPayer〉
  }
  assert: {
    invoke: 〈1;let sam#1〉
    invoke: _
    res: (〈1;subject〉 & {
      in: 〈1;invoke〉
    })
  }
  subject: {
    in: 〈1;#ReturnData〉
    _computed: (〈1;#computeF1040〉 & {
      in: 〈1;in〉
    })
  }
  #computeF1040: {
    in: 〈1;#ReturnData〉
  }
  #ReturnData: {
    taxPayer?: 〈1;#TaxPayer〉
  }
  #TaxPayer: {
    self?: _
  }
}
