Issue #1608: The checker accepts s.len() on text, against ADR-320 D3

Open and answer this issue on GitHub.

ready · opened 2026-11-15 · updated 2026-11-15 · 0 comments

ADR-320 D3 says text is read through a view that names its unit: there is no s.len() and no s[i] on text. D4 gives s.bytes.len() in constant time. The checker still accepts s.len() on a text.

Probe

fn main() {
    let s = "abc"
    println(s.len())
}

Expected: an error naming the views (s.bytes.len(), s.chars().count()). Actual: it compiles and prints 3.

Found by the prover lane on #1556 (the bounds walk now treats s.len() and s.bytes.len() as one length; that stays correct after this change).

To build

  1. The checker refuses .len() on a text receiver with a new NK code (from the block the supervisor reserves), the message naming s.bytes.len() and s.chars().count().
  2. Migrate every text .len() in crates/nikaia-std/src/tools/*.nika, tools/*.nika, scripts/*.nika, packages and tests/compiler/ to s.bytes.len() (byte length is what they mean today); re-lower.
  3. Guide and specification examples that write s.len() on text are corrected.
  4. A test in tests/compiler/ with the .stderr of the refusal.

Done when

The probe is refused with the new code, no .nika in the repository calls .len() on text, and the suite is green.


Generated by Claude Code

Back to Open Issues