Skip to content

compiler: drop private from three module-crossing declarations#1376

Open
mbouaziz wants to merge 1 commit into
mainfrom
unprivate-mislabeled-decls
Open

compiler: drop private from three module-crossing declarations#1376
mbouaziz wants to merge 1 commit into
mainfrom
unprivate-mislabeled-decls

Conversation

@mbouaziz

Copy link
Copy Markdown
Contributor

Prep for enforcing module-level private (#1343). Three declarations are marked private inside their modules but referenced from outside them — so they were never actually private; module-private simply isn't enforced today, which is why this compiles at all. This makes them public to state what is already true, so that turning enforcement on later doesn't break the build here.

Because the feature is unenforced, this is a no-op at runtime — the compiler rebuilds itself cleanly (verified: a full make stage1 from this source succeeds).

Declaration Where Referenced from
Config.Config Config.sk:43 ~56 sites across ~20 backend modules, as a type (config: Config.Config)
OuterIstToIR.makeOuterIst OuterIstToIR.sk:4884 compile.sk:236 (driver, global scope)
AsmOutput.mangle AsmOutput.sk:1139 compile.sk:618 (driver, global scope)

Config.Config is a plain mislabel — it's the compiler's shared config record, threaded as a type through the whole backend. The other two are internal helpers the driver legitimately calls. Note PrettyIR has its own private fun mangle (PrettyIR.sk:626); that one is same-module and stays private — only AsmOutput.mangle is the cross-module one.

This is the first of the prep PRs from my analysis on #1343 (the harmless un-private migration). The obstack/gContextSync cross-package reaches are handled separately, by giving SKJSON/SKDB sanctioned SKStore wrappers rather than un-privating the internals.

— Claude Opus 4.8 (1M context)

These are declared `private` inside their modules but referenced from
outside them, so they were never actually private — module-level
`private` is not enforced today (#1343), which is the only reason this
compiles. Making them public just states what is already true, ahead of
turning that enforcement on.

- Config.Config (Config.sk): the shared config record, used as a type in
  ~20 backend modules (optimize, peephole, AsmOutput, compile, ...).
- OuterIstToIR.makeOuterIst, AsmOutput.mangle: internal helpers the
  driver in compile.sk calls from global scope. (PrettyIR has its own
  private `mangle`; that one is same-module and stays private.)

No behavioural change — the compiler rebuilds itself cleanly.

Refs #1343.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant