Skip to content

D100: a lint removes pub from items nothing outside the package uses #2211

Closed

Description

@ehartford

D100 (Eric, 2026-10-05): "when it lands, a lint that removes pub from items nothing outside the package uses would clean up the 1,529 automatically."

Package-wide visibility (#2210) made pub mean one thing: the declaration leaves the package. Every pub written to satisfy the old per-file rule inside one package (the compiler's tree, the stdlib's cross-file helpers) is now noise that overstates the API.

Lint: for each pub declaration, if no module of another package references it (Sema's resolved references over the whole compilation, not a text search), report it, and offer an --apply that removes the pub (a Lexer-accurate byte edit, as tools/migrate_receivers.w does). Library packages whose API is consumed outside the compilation need the opposite stance: their pub is the API, so the lint applies only within a program, or with the package's consumers in the compilation.

Activity

  1. ehartford commented on Oct 7, 2026

    @ehartford
    ContributorAuthor

    Tool landed in 60e53a2 (stack #2251): with run tools/pub_lint.w <root.w> [--apply] over the analyzer's new reference facts (kind 28) plus call, method-resolution and type facts. Over src/main.w it reports 1507 pub used by nothing outside the compiler's package. Not applied: the pinned seed still enforces per-module privacy (probed 2026-10-07: symbol 'helper' is private to module 'Helper.w' on src/main, accepted by the fresh compiler), so the apply waits for a seed that implements D100 to be published and pinned; then --apply and one battery.

  2. ehartford commented on Oct 19, 2026

    @ehartford
    ContributorAuthor

    Done for the compiler: tools/pub_lint.w reads one analyze pass and #2463 swept src/ - 1,763 pub removed, re-run reports 0 of 10,868 declarations, generators no longer emit pub for Embedded*Data. lib/std is excluded by ruling (Eric, 2026-10-19): its pub is its API to consumers outside this compilation, and no sweep runs there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions