unit_mismatch

Diagnostic `nanook::expr::unit_mismatch`

Summary

incompatible units: `{0}` {2} `{1}`

Help

both sides of {2} must measure the same kind of thing (bytes, seconds, ...). a raw literal like 42 (no unit) compares against any metric.

Details

When this fires

The type checker compared two values whose units don't line up. Bytes can't compare to seconds, percent can't add to bytes, etc. A raw literal like 42 (no unit) is still allowed against any metric, since you might be picking a sentinel.

What to check

Multiplicative ops (*, /) infer derived units (Bytes / Seconds -> Bps), so wrap a ratio in parens if you want to compare it to a fraction.

# broken
expr = "mem.available > 10s"
# fixed
expr = "mem.available > 100MB"

Caught by nanook check during type-check. See @/docs/nanook-expr.md for the unit table.