Repository navigation
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 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.
The
c_idsscanner resolvedCID(k)/FID(k)by text over the whole effect source, but 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 failed to splice, and a quotedCID(...)on the next line leaked out of the comment and failed the build.Fix: splice a C source's backslash-newline (C's phase-2 line splice,
\+ CR? LF) before scanning, and leave JS lines alone. The line-comment pattern now ends at the newline. This matches each host's real rules: C keeps a continuation inside a comment, JS does not.Added a JS-lane regression test (
tests/io/effect_comment_backslash): a// ... \comment directly beforeio_eff(CID(answer), ...)— fails on the old scanner (unresolved CID), passes on the new one. Verified the scanner behavior against the previous implementation for the JS, CRLF-C, and LF-C cases.