unit_finding_dimensional_mismatch
Stable constant · Units
Tier: stable · Kind: constant · Topic: Units
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
| not exported | not exported | UNIT_FINDING_DIMENSIONAL_MISMATCH | UNIT_FINDING_DIMENSIONAL_MISMATCH | UnitFindingDimensionalMismatch |
Julia
Julia does not export this constant.
TypeScript
TypeScript does not export this constant.
Python
UNIT_FINDING_DIMENSIONAL_MISMATCH = 'dimensional_mismatch'
A PROVABLE inconsistency: metres added to kilograms, an equation whose sides cannot agree. The file is wrong.
Rust
pub const UNIT_FINDING_DIMENSIONAL_MISMATCH: &str = crate::diagnostic::codes::DIMENSIONAL_MISMATCH;
The cross-binding code values a dimensional finding can carry, as surfaced
on crate::validate::UnitWarning::code. Mirrors Go’s UnitFinding*
constants (pkg/earthsci-ast-go/pkg/esm/units.go) and TypeScript’s
UnitWarning['code'] union (pkg/earthsci-ast-ts/src/units.ts).
UNIT_FINDING_DIMENSIONAL_MISMATCH— a PROVABLE inconsistency: adding metres to kilograms, an equation whose sides cannot agree. A defect in the FILE; this binding promotes it to aunit_inconsistencystructural error.UNIT_FINDING_UNPARSEABLE— a declared unit string that does not denote a real unit. Also a defect in the FILE; promoted tounit_parse_errorat the declaration’s own pointer.UNIT_FINDING_ANALYSIS— the checker cannot DETERMINE a dimension. A limit of the ANALYSIS, not a defect, so it stays a non-blocking warning.
These strings are a cross-binding contract; they must not change.
Go
const UnitFindingDimensionalMismatch = "dimensional_mismatch"
Unit-finding codes. A unit finding is either a DEFECT IN THE FILE — which invalidates the document — or a limit of the ANALYSIS, which does not. The classification is decided at the point the finding is raised (never recovered later from the prose) and carried on UnitWarning.Code; ValidateStructuralWithCodes promotes the defect-bearing codes to unit_inconsistency structural errors.
The split is the cross-binding policy and mirrors TypeScript’s units.ts:
- UnitFindingDimensionalMismatch — a PROVABLE inconsistency: adding metres to kilograms, log() of a dimensional quantity, an equation whose sides have different dimensions. The file is wrong. → HARD ERROR.
- UnitFindingUnparseable — a declared unit string that does not denote a real unit (“not_a_unit”). The file is wrong. → HARD ERROR.
- UnitFindingAnalysis — the checker cannot DETERMINE a dimension: a symbolic (non-literal) exponent, an operator with no dimensional rule (fn/table_lookup), a malformed arity. That is a statement about the checker, not a defect in the file. → WARNING.
- UnitFindingDimensionlessLiteral — the esm-spec §4.8.6 warning stage: a site that fails only when nonzero bare literals are dimensionless. Never promoted. → WARNING.
An unknown VARIABLE is likewise never a mismatch (it propagates as “unknown” and suppresses the check); it is separately a hard undefined_variable error, so the units layer does not double-report it.