Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Name resolution

Platform spec node

Name resolution

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki
flowchart TD
  useDecl[use declaration]
  scope[Build scope chain]
  path[Qualify path segments]
  vis[Check visibility]
  bind[Bind to symbol]
  useDecl --> scope --> path --> vis --> bind
  bind --> value[Value symbol]
  bind --> type[Type symbol]
  bind --> mod[Module re-export]

Defines how identifiers and paths bind to program items across modules. Module shape is in Modules and visibility.

  • use Path; imports the final segment into the current scope.
  • use Path as Alias; binds the resolved target to Alias.
  • use before declaration in the same module must error (E1106) when forward reference is illegal.
  • Unknown import paths must error (E1105); ambiguous imports must error (E1104).
  • Value paths resolve to functions, locals, constants, enum constructors, and contract namespaces.
  • Type paths resolve to types, generics, and primitive names.
  • Unresolved value E1101; unresolved type E1201; unknown module segment E1108.
  • Inner scopes may shadow outer locals; shadowing should warn (W1103).
  • Duplicate definitions in the same scope must error (E1006, E1102).
  • Resolution must respect visibility from the importer’s module.
  • Generic parameters shadow type names in signature scope only for the declaring signature.

Resolution is compile-time; emitted metadata records stable qualifiedName strings for tooling.

Import band E1104–E1108; resolve duplicates E1102. Registry: Diagnostic code registry.

L1 resolver tests must pass for cross-module use and private item rejection.

  • D-LM-NAME-001 — Single resolver graph: Package driver and typechecker share one resolution snapshot per compilation.
  • D-LM-NAME-002 — Contract namespaces: Contracts may appear as path prefixes for static methods without a separate use import of each method.
  • D-LM-NAME-003 — Qualified names for tooling: Emitted qualifiedName strings must be stable across compiles for the same source snapshot.
  • D-LM-NAME-004 — No implicit null imports: Resolution must not inject nullable or optional aliases.

Scopes, imports, and shadowing tie syntax to symbols. Diagnostics for unresolved names must cite these rules verbatim.