Diagnostic and cause
СсылкаExtern declaration problem
- Семейство
- topaz
- Этап
- resolve
- Код
TPZ5030
Причина и условия
Import each extern module by an identity declared in topaz.toml. A missing module under an already declared extern namespace is rejected as TPZ5030.
Связанное правило · Extern declaration problem →Действия
Declare the extern interface in topaz.toml and check its names and signatures. Import the module identity that the package declares.
Compiler phase: check/package.
Compiler explanation: An extern module or function declaration is missing, malformed, duplicated, or not declared for an imported extern module.
Message templates are Pending. The explanation above is not an observed CLI message.
Import each extern module by an identity declared in topaz.toml. A missing module under an already declared extern namespace is rejected as TPZ5030.
Extern declaration problem
Import each extern module by an identity declared in topaz.toml. A missing module under an already declared extern namespace is rejected as TPZ5030.
Response
СсылкаDeclare the extern interface in topaz.toml and check its names and signatures. Import the module identity that the package declares.
Reproduction and verification
СсылкаRejected program
Ссылкаimport host.missing { twice }export function main(args: Array<string>, stdin: string) -> Result<int, string> {Ok(0)}
Нет стандартного вывода.[package]name = "diagnostic_extern"version = "0.1.0"language = "5.21"entry = "main.tpz"[extern.host.math]hash = "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"abi_hash = "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"[[extern.host.math.functions]]name = "twice"params = ["int"]result = "int"[extern.host.math.replay]fixture = "replay/host-math.jsonl"[extern.host.math.sandbox]kind = "replay"
{"module":"host.math","function":"twice","args":[{"$":"int","value":"21"}],"result":{"$":"int","value":"42"}}
Ожидаемый результат
Ожидаемый результат
Этап отклонения resolve. Ненулевой код завершения.
diagnostics-undeclared-extern-module at
main.tpz:1:8
This complete package fixture uses invocationArgs without a positional source file.
Repaired program
Ссылкаimport host.math { twice }export function main(args: Array<string>, stdin: string) -> Result<int, string> {Ok(0)}
[package]name = "diagnostic_extern"version = "0.1.0"language = "5.21"entry = "main.tpz"[extern.host.math]hash = "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"abi_hash = "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"[[extern.host.math.functions]]name = "twice"params = ["int"]result = "int"[extern.host.math.replay]fixture = "replay/host-math.jsonl"[extern.host.math.sandbox]kind = "replay"
{"module":"host.math","function":"twice","args":[{"$":"int","value":"21"}],"result":{"$":"int","value":"42"}}
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.
This complete package fixture uses invocationArgs without a positional source file.