Diagnostic and cause
LinkName is not exported
- Family
- topaz
- Phase
- resolve
- Code
TPZ3009
Cause and conditions
Selecting a private or absent name through an import selection or namespace member produces TPZ3009. An empty export table follows the same rule.
Related rule: Trigger and repairResponse
Select an exported name, or add export to the declaration when it belongs in the public API.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 414-426 - compiler/crates/topaz_self_frontend/topaz/resolver/scopes_walk.tpz at
151141d7bb44· 314-314 - compiler/crates/topaz_self_frontend/topaz/resolver/validation_init.tpz at
151141d7bb44· 203-203 - compiler/crates/topaz_self_frontend/topaz/resolver/validation_init.tpz at
151141d7bb44· 174-211 - TPZ3009 at
151141d7bb44
The compiler facts describe the earlier module implementation. The uniform module contract permits empty export tables and rejects unavailable selections with TPZ3009.
Compiler phase: resolve.
Compiler explanation: A selected import or namespace member names something the module does not export.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ3009]:
hiddenis not exported bylib
The selected import or namespace member is absent from the target module's exported declarations. A matching private declaration does not make the name available to importers. The same condition applies when the export table is empty.
Trigger and repair
Selecting a private or absent name through an import selection or namespace member produces TPZ3009. An empty export table follows the same rule.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/resolver/validation_init.tpz at
151141d7bb44· 174-211 - TPZ3009 at
151141d7bb44
Response
LinkSelect an exported name, or add export to the declaration when it belongs in the public API.
Reproduction and verification
LinkRejected program
Linkimport lib { hidden }
No stdout.
let hidden = 1export let visible = 2
Expected result
Expected result
Rejection during resolve. Nonzero exit.
TPZ3009diagnostic-tpz3009 atexample.tpz:1:14
The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 414-426 - compiler/crates/topaz_self_frontend/topaz/resolver/scopes_walk.tpz at
151141d7bb44· 314-314 - compiler/crates/topaz_self_frontend/topaz/resolver/validation_init.tpz at
151141d7bb44· 203-203 - compiler/crates/topaz_self_frontend/topaz/resolver/validation_init.tpz at
151141d7bb44· 174-211 - TPZ3009 at
151141d7bb44
Corrected program
Linkimport lib { hidden }
export let hidden = 1export let visible = 2
Expected result
Expected result
Checking accepts the program. Exit code 0.
This program applies the repair described above. The verification status records whether it has been run.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/resolver/validation_init.tpz at
151141d7bb44· 174-211 - TPZ3009 at
151141d7bb44