ww imports: reject init bindings before recovery
This commit is contained in:
15
docs/spec.md
15
docs/spec.md
@@ -328,6 +328,21 @@ ImportPath = ident { "." ident } .
|
||||
Neither form exposes an imported declaration as a bare `Name`; ordinary
|
||||
unqualified lookup remains limited to lexical, builtin, and same-package
|
||||
declarations.
|
||||
- An import whose effective file-local qualifier is `init` is invalid. This
|
||||
includes both `import init acme.codec;` and an unaliased import whose target
|
||||
declares `package init;`. Each resolved occurrence is rejected at its first
|
||||
import-spec token (the explicit alias when present, otherwise the first path
|
||||
token) as `cannot import package as init - init must be a func`. The rejected
|
||||
qualifier is never installed and does not participate in unused-import,
|
||||
duplicate-binding, or declaration/import-collision recovery; consequently a
|
||||
later `init.Name` independently reports an undefined `init`. Repeated invalid
|
||||
occurrences each report the core error. Import resolution retains
|
||||
precedence, so a missing target fails as missing without an additional
|
||||
effective-`init` error. A resolved rejected occurrence remains source and
|
||||
graph provenance for its exact dotted target: only its file-local qualifier
|
||||
binding is absent. Canonical package, import, graph, action, artifact,
|
||||
symbol, `.wwi`, publication, and persistence identity never derives from the
|
||||
rejected qualifier or from the target's declared name.
|
||||
- `import _ acme.codec;` is a blank side-effect import. The lone `_` creates no
|
||||
qualifier, exposes no bare declaration, and is never diagnosed as unused.
|
||||
It is nevertheless a real import occurrence: resolution and all missing,
|
||||
|
||||
Reference in New Issue
Block a user