Repository navigation
fix(effects): scan CID/FID with the source's own comment rules - #1653
Merged
Lorenzobattistela merged 2 commits intoOct 19, 2026
Merged
Conversation
The c_ids scanner applied C's backslash-newline continuation to every source, so a JS `//` comment ending in a backslash swallowed the next line: a following `io_eff(CID(...))` line was left unresolved and the effect died at runtime (ReferenceError: CID is not defined). And it used `\\\n` for the continuation, which misses a CRLF C comment (so a quoted CID leaked out of a C comment and failed the build). Splice a C source's backslash-newline (line continuation) before scanning and leave JS lines alone, and change the line-comment pattern to end at the newline. Resolves bendlang#1604.
This was referenced Oct 18, 2026
Restore `//.*` so a comment still ends at CR, LS and PS, splice C's backslash-newline after trailing blanks too, as clang and gcc do, and do it at the C call site instead of behind a flag. The regression now has a CRLF C twin: a continued comment that quotes ids and a CID split across lines. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Lorenzobattistela
approved these changes
Oct 19, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #1604. Supersedes #1606, which takes the same approach; its C test cases are folded in here.
c_idsresolvesCID(k)/FID(k)by scanning the text of an effect source, and it applied C's line-continuation rule to every source://comment ending in a backslash swallowed the next line, so a followingio_eff(CID(...))was left unresolved and the effect died at runtime withReferenceError: CID is not defined.\+ LF, so a CRLF// ... \comment did not continue, and a quotedCID(...)on the next line leaked out of the comment and failed the build. ACIDtoken split by a backslash-newline was not resolved either.Fix (
bend2/comp.ts):effect_srcssplices a C source's backslash-newline (\, optional trailing blanks, CR? LF; clang and gcc splice the same) before scanning, and leaves JS alone. The//pattern stays//.*, so a comment still ends at CR, LS and PS. This matches what each host does: C keeps a continuation inside a comment, JS does not.Test:
tests/io/effect_comment_backslashruns on both lanes. The JS twin has a// C:\comment right beforeio_eff(CID(answer), ...). The C twin is CRLF and has continued comments that quote ids, one with trailing spaces, and aCIDsplit across lines. Both fail on main and print42here.Gates on main bedc964: repo 54/54, test 1657/1657, perf 124/124, ping 62/62, safe: 0 false rejects. comp.ts 64,178 → 64,237 ttok.
🤖 Generated with Claude Code