Skip to content

compiler: Export a version of `newNameCache` that is not prone to footguns.

Zubin requested to merge wip/26135 into master

compiler: Export a version of newNameCache that is not prone to footguns. newNameCache must be initialized with both a non-"reserved" unique tag, as well as a list of known key names. Failing to do so results in hard to debug unique conflicts.

It is difficult for API users to tell which unique tags are safe to use. So instead of leaving this up to the user to decide, we now export a version of newNameCache which uses a guaranteed non-reserved unique tag. In fact, this is now the way the unique tag is initialized for all invocations of the compiler.

The original version of newNameCache is now exported as newNameCache' for advanced users.

We also deprecate initNameCache as it is also prone to footguns and is completely subsumed in functionality by newNameCache and newNameCache'.

Fixes #26135 (closed) and #26055 (closed)

Merge request reports

Loading