Assert and record that code generation requires distinct uiques for let-binders
Simon writes in #15754:
Another invariant that the code generator needs is (I believe) that every let-binder has a distinct unique. We can't re-use the same unique, even in a different scope, let alone shadowing. Why? Because (I believe) that the code generator uses these uniques to generate unique top level labels for the entry code and info table for the closure.
Now, it's probably the case that they are unique anyway; but we should either
- Write this down as a invariant of STG, or
- Establish this invariant in the immediately-before-codegen pass that gets the free vars right, or
- Not assume it in the code generator