Invocation, options and results
Linktopaz check
topaz check [entry]
Input
Accept zero or one entry operand. Without an entry, load the package selected by - or the current directory. With an entry, resolve that compilation unit under the selected source root.
Accept the listed compiler, lock, export, verbosity, root, profile, format, language, and resource options. - and - are rejected. A profile cannot be combined with -, and it must match the selected canonical language profile.
Reject unreadable inputs, invalid package metadata, missing dependencies, lock mismatches, parse errors, name resolution errors, type errors, and profile violations before any program execution.
Options and conflicts
| Option | Default | Contract | Conflicts |
|---|---|---|---|
--compiler rust|self | self | compiler selector (default self); rust selects the reference compiler Also rejects combination with --producer, --self-source. | None listed |
--locked | false | Verify topaz.lock before compiling the selected package. | None listed |
--exports-json | false | check only: on a clean unit, print the checked public export surface as one deterministic JSON object | --profile |
--verbose | false | Reports the selected compiler and whether it was explicit or the default. For | None listed |
--root <dir> | entry directory; . in package mode | The explicit source root or package root for this invocation. | None listed |
--profile agent-pack|test-profile|bootstrap | Not specified | check only: narrow canonical topaz-5.21 to the selected executable usage profile | --exports-json |
--format human|json | human | Selects human or JSON diagnostics on standard error. The default is human output. | None listed |
--language-version <5.21> | 5.21 | language version selector | None listed |
--compiler-memory-mib <MiB> | 8192 | self compiler worker memory budget (8192); overrides TOPAZ_COMPILER_MEMORY_MIB A positive integer is required. Environment input: TOPAZ_COMPILER_MEMORY_MIB. | None listed |
--compiler-time-ms <ms> | 1800000 | self compilation wall-clock budget (1800000); overrides TOPAZ_COMPILER_TIME_MS A positive integer is required. Environment input: TOPAZ_COMPILER_TIME_MS. | None listed |
Output channels
stdout
stderr
Exit status
0
The selected unit passes every requested check and report generation succeeds.
1
Arguments, package or lock loading, source checking, profile admission, report generation, or compiler execution fails.
Effects
Read the source graph, manifest, lock, installed standard library, and existing vendor tree. Do not modify project inputs or materialize dependencies. Compiler-owned temporary files may be used.
Checking performs no network access. A missing dependency is an error and never starts a registry download.
Fixed source and dependency bytes, lock identity, root and entry paths, language and profile, compiler identity, and presentation settings produce the same diagnostics and public export ordering. Host resource failures are external inputs.
Package dependencies use table declarations. Registry dependencies require a valid matching lock and existing verified vendor content. - verifies the existing lock before checking and never rewrites it. A standalone entry cannot use - to create package context.
Registry dependencies or Lispex configuration require explicit -, even when a matching lock exists. Without that option, a local-only package can load declared path dependencies by their expected hashes. Locked loading rejects missing or stale state and never repairs it.
Standalone entry mode rejects -. Selected-entry test is the exception when an explicit root contains the package manifest and the entry belongs to that package.
Operation
LinkUse check before execution. See the check examples for diagnostics and export inspection.
Option conditions
LinkUse - for JSON diagnostics. The - spelling is rejected.
- applies to check only
- applies to check only
- requires canonical language topaz-
- cannot be combined with -
--locked applies to package-mode check, run, emit, build, test, doc, bench, compiler observe, compiler preview. Selected-entry test also accepts it when --root contains topaz.toml.
- cannot be combined with bootstrap - or -
The - option is rejected. The check command performs type checking.
Behavior contract
LinkCommand behavior
Arguments and rejection
Accept zero or one entry operand. Without an entry, load the package selected by - or the current directory. With an entry, resolve that compilation unit under the selected source root.
Accept the listed compiler, lock, export, verbosity, root, profile, format, language, and resource options. - and - are rejected. A profile cannot be combined with -, and it must match the selected canonical language profile.
Reject unreadable inputs, invalid package metadata, missing dependencies, lock mismatches, parse errors, name resolution errors, type errors, and profile violations before any program execution.
Output
Unprofiled SELF output follows the check channel rule. A successful standalone check writes the entry label with types- and resolve- summaries. Profile checks include the profile name.
JSON diagnostics are newline-delimited objects on standard error. Each object carries string code, severity, and message fields, one primary label, a secondary label array, and a string notes array. Each label has string file and message fields, integer line, col, end, end, lo, and hi fields. Label coordinates follow the source position rule.
A profile diagnostic uses a topaz. object with string profile, nullable string rule, the nested diagnostic object, and nullable fix. A fix has string applicability equal to machine-, string description, and an edit object. The edit carries file, line, col, end, end, lo, hi, and string replacement with the same coordinate meanings as a label.
A profile check with JSON output writes one topaz. summary on standard output with profile, language, status, diagnostic, and error. Status is pass or fail. Counts are nonnegative integers.
Successful export inspection follows the checked export rule. The export object's modules array identifies each module by identity, signature, and ambient, with values, aliases, records, enums, newtypes, and conformances arrays. Value rows carry name, type, vars, bounds, required, names, names, and defaulted. Export data is omitted on failure. Diagnostic JSON and export JSON may be selected together because they serve different purposes.
Each alias row has string name, nonnegative integer params, and string type. params counts declared type parameters. type contains the declaration's target type text.
Each record row has string name, nonnegative integer params, and a fields array. Each field has string name, string type, and boolean has. Fields retain declaration order. has records whether a default initializer exists and does not serialize its value.
Each enum row has string name, nonnegative integer params, and a variants array. Each variant has string name and a payloads array of type strings. Variants and payloads retain declaration order. A variant with no payload has an empty payloads array.
Each newtype row has string name, nonnegative integer params, and string base. base contains the declaration's underlying type text. Alias, field, payload, and base type text retains declaration spelling and need not use the checked value type renderer.
The conformances field is an empty array in this report. It leaves the module's protocol membership unspecified. Consumers must not infer that a module implements no protocols from that field.
A value row's vars counts declared function type parameters when its function declaration metadata is available. bounds has one string array per type parameter. names and defaulted align in parameter declaration order. required counts declared parameters without a default initializer.
When names is false, declaration parameter metadata is unavailable. The accompanying zero vars and required values and empty bounds, names, and defaulted arrays are placeholders. They do not establish zero arity or the absence of generic parameters.
A value type equal to unknown records the absence of an exported checked type node. The checked type renderer uses ? for an unknown semantic type and ?inference for an inference variable. These strings remain explicit metadata states and must not be treated as established concrete types.
The modules array includes resolved module identities even when a module has no exported rows. Module identities are sorted, and declaration rows within each category are sorted by exported name. Field, variant, payload, parameter, and bound order follows the declaration.
signature is sha256 followed by a colon and 64 lowercase hexadecimal digits. It fingerprints the serialized module report body before the hash field is inserted. That body includes identity, ambient, and the six declaration arrays. Function bodies and default initializer values are not serialized into that body. Package integrity is established through the lock and package content identities.
Argument, loader, and compiler-startup errors remain textual errors on standard error. Selecting JSON diagnostics does not turn a command-validation failure into a source diagnostic.
Exit status
Exit 0 means the unit passed all selected checks and its requested report was produced. Exit 1 covers argument errors, package or lock errors, source diagnostics, profile rejection, report failure, worker failure, and resource exhaustion.
Filesystem effects
Read the source graph, manifest, lock, installed standard library, and existing vendor tree. Do not modify project inputs or materialize dependencies. Compiler-owned temporary files may be used.
Network access
Checking performs no network access. A missing dependency is an error and never starts a registry download.
Reproducibility
Fixed source and dependency bytes, lock identity, root and entry paths, language and profile, compiler identity, and presentation settings produce the same diagnostics and public export ordering. Host resource failures are external inputs.
Packages and locks
Package dependencies use table declarations. Registry dependencies require a valid matching lock and existing verified vendor content. - verifies the existing lock before checking and never rewrites it. A standalone entry cannot use - to create package context.
Registry dependencies or Lispex configuration require explicit -, even when a matching lock exists. Without that option, a local-only package can load declared path dependencies by their expected hashes. Locked loading rejects missing or stale state and never repairs it.
Standalone entry mode rejects -. Selected-entry test is the exception when an explicit root contains the package manifest and the entry belongs to that package.
Why
Checking, export inspection, and profile admission answer different questions. Their output channels preserve those intentions while a nonzero status prevents diagnostics from being mistaken for success.
Source evidence
- compiler/crates/topaz_cli/src/command/flags.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/dispatch.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/validation.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/compiler_support.rs at
b48527d0a174 - docs/content-next/en/functions-generics.json at
b48527d0a174 -
compiler/crates/topaz_cli/src/compile/self_host.rsat570530e69141· 320-467 -
compiler/crates/topaz_cli/src/compile/self_host.rsat570530e69141· 457-637 -
compiler/crates/topaz_cli/src/compile/self_host.rsat570530e69141· 640-754
The linked public CLI recipe checks exit 0 for one valid generic declaration. Its stream expectations are unspecified.
The safe recipe checks one valid unit in human mode. JSON diagnostics, profile summaries, exports, and package-lock failures need other argument vectors and remain not-run in this recipe runner.
Example contract
LinkExample contract
The invocation topaz check main. is expected to exit with 0.
Reuse the complete generic declaration accepted by the pilot. A successful fixture does not settle generic-call or inference contracts.
Why
The input and result of identity share one type parameter. Returning that input preserves its type for every permitted instantiation.
Source evidence
- compiler/crates/topaz_cli/src/command/flags.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/dispatch.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/validation.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/compiler_support.rs at
b48527d0a174 - docs/content-next/en/functions-generics.json at
b48527d0a174
Example
LinkSmall source invocation
Linkfunction identity<T>(value: T) -> T {value}
Expected result
Expected result
Checking accepts the program. Exit code 0.
Reuse the complete generic declaration accepted by the pilot. A successful fixture does not settle generic-call or inference contracts.
Source evidence
- compiler/crates/topaz_cli/src/command/flags.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/dispatch.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/command/validation.rs at
b48527d0a174 - compiler/crates/topaz_cli/src/compiler_support.rs at
b48527d0a174 - docs/content-next/en/functions-generics.json at
b48527d0a174
Verification scope
LinkObserved with Topaz 5.21.3 on 2026-11-06T08:36:29.642Z. This invocation passed; exit 0. 1 assertions were evaluated against the independent expected result. Execution record. This result covers the displayed invocation. That record uses the earlier fixture revision. The current recipe has not been run.