Diagnostic and cause
СсылкаNamespace used as value
- Семейство
- topaz
- Этап
- resolve
- Код
TPZ3012
Причина и условия
Reading an imported namespace as a standalone value produces TPZ3012. Select an exported member instead.
Связанное правило · Trigger and repair →Действия
Select an exported member, such as ns.member, before storing or passing the value.
Compiler phase: resolve.
Compiler explanation: A module namespace binding appears where a runtime value is required.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
⟨value⟩is a namespace, not a value; it may appear only as⟨value⟩.Sourcemember
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ3012]:
nsis a namespace, not a value; it may appear only asns.member
The expression names the module namespace itself. A namespace provides member access and is not a runtime value.
Trigger and repair
Reading an imported namespace as a standalone value produces TPZ3012. Select an exported member instead.
Response
СсылкаSelect an exported member, such as ns.member, before storing or passing the value.
Reproduction and verification
СсылкаRejected program
Ссылкаimport lib as nslet value = ns
Нет стандартного вывода.export let member = 1
Ожидаемый результат
Ожидаемый результат
Этап отклонения resolve. Ненулевой код завершения.
diagnostic-tpz3012 at
example.tpz:2:13
The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.
Corrected program
Ссылкаimport lib as nslet value = ns.member
export let member = 1
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.
This program applies the repair described above. The verification status records whether it has been run.