Skip to content

semantic: module-member access has two authorities — private module variables (from lib import __w refused, lib.__w runs), escaped module variables lose their escape, aliased escaped types keep it #2131

Description

@antonsynd

Found while fixing #2033's import residue:

  1. from lib import __w → SPY0283, but lib.__w runs (module variables are emitted public regardless of spelling). Needs a ruling on module-variable privacy (functions are now consistent: SPY0283 both ways).
  2. An escaped module variable (\__v`: int = 6) loses its escape on the exported symbol: from lib import `__v`reads it private (SPY0283);lib.`__v`is SPY0908 CS0117__V`.
  3. from lib import \Qux` as K; K()` → SPY0200 (the alias clone keeps the declaration's escape); clearing it semantically turns it into CS0234 because the emitter spells type references from the clone's escape flag.
  4. Root: NameResolver records every module-level function (and several module symbols) AccessLevel = Public while ModuleLoader/the emitter use AccessLevelConventions.FromName — two access authorities; the lane routed around it with AccessLevelConventions.OfModuleMember. One authority (the declaration's access level, escape included) read by NameResolver, ModuleLoader, the emitter and every import position.

Found by /verify-implementation plan-0ca7b7 semantic fix lane (pre-existing at acd1d40 unless stated).

Activity

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

    lane:silent-wrongCompiles and runs with wrong output or semantics (rank first)reach:probeNeeds an escaped spelling, a wrong-annotation probe or a python3 message diff

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions