Diagnostic and cause
LinkReserved module form
- Family
- topaz
- Phase
- parse
- Code
TPZ2008
Cause and conditions
Module imports use dotted identifier paths. String and template paths and use items are rejected.
Related rule: Trigger and repairResponse
Write import lib and provide the corresponding module file. Use import for module imports.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 283-291 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1262-1262 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1017-1037 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1258-1281 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1314-1324 - TPZ2008 at
151141d7bb44
Compiler phase: parse.
Compiler explanation: The source uses a module syntax form reserved but not defined by the current grammar.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
- string and template module paths are reserved and unused; module paths are dotted identifiers Source
useis reserved and unused; did you meanimport? Source
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ2008]: string and template module paths are reserved and unused; module paths are dotted identifiers
The import uses a quoted module path. Module paths are dotted identifiers. The reserved use item produces the same diagnostic.
Trigger and repair
Module imports use dotted identifier paths. String and template paths and use items are rejected.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1017-1037 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1258-1281 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1314-1324 - TPZ2008 at
151141d7bb44
Response
LinkWrite import lib and provide the corresponding module file. Use import for module imports.
Reproduction and verification
LinkRejected program
Linkimport "lib"
No stdout.
Expected result
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· 283-291 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1262-1262 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1017-1037 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1258-1281 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1314-1324 - TPZ2008 at
151141d7bb44
Corrected program
Linkimport lib
export let value = 1
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/parser/declarations_modules.tpz at
151141d7bb44· 1017-1037 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1258-1281 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 1314-1324 - TPZ2008 at
151141d7bb44