Skip to content

State the bare-CR line rule in C-220 and C-225 - #112

Merged
O6lvl4 merged 2 commits into
mainfrom
contracts-2813-bare-cr
Sep 28, 2026
Merged

O6lvl4 merged 2 commits into
mainfrom
contracts-2813-bare-cr

Conversation

@O6lvl4

@O6lvl4 O6lvl4 commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

almide/almide#2813 (reported by atzurody): the incumbent wasm leg stripped a trailing bare \r from the last line of string.lines / fs.read_lines / fs.fold_lines — "abc\r" read as ["abc"] where native (str::lines) and the structural leg read ["abc\r"].

The ledger text invited it: C-220 and C-225 said "one trailing \r stripped per line", which is exactly the incumbent's behaviour on an unterminated last line. And the reference evaluator carried the same rule — both string.lines (ref/src/stdlib.rs) and the fs splitter split_lines (ref/src/stdlib_ext.rs) popped a \r from the final unterminated line.

  • ref: the final unterminated line keeps a trailing \r; a \r is removed only together with the \n it precedes.
  • C-220 / C-225: the statement now says "the \r of a \r\n terminator stripped with it and a bare \r kept as line content (a \r ending the input/file stays on the last line)".
  • Fixture spec/wasm_cross/line_endings_bare_cr.almd (evidence for both): CR at the end, doubled at the end, ending the last of two lines, mid-line, before a CRLF, and alone — each line printed with its CRs spelled out, over string.lines, fs.read_lines, fs.fold_lines (String / Int / fallible) and fs.for_each_line.

Local: conformance.py --legs cross,ref over the new fixture plus string_lines.almd / fs_read_lines.almd against the fixed almide build: 3/3 cross, 3/3 ref (judged, no abstain). All pre-commit gates green.

The implementation PR (almide) follows after this merges and the pin advances.

O6lvl4 and others added 2 commits September 28, 2026 11:01
…tor's string.lines and fs line splitter

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ngs_bare_cr fixture

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant