Repository navigation
fix(comp): avoid JavaScript stack overflows when counting lines - #2216
Open
sebastian-griego wants to merge 1 commit into
Open
sebastian-griego wants to merge 1 commit into
sebastian-griego wants to merge 1 commit into
Conversation
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.
Counting the lines in this repository's README overflows the default Node stack. Counting the lines in the changelog also overflows the default Bun stack. Both failures occur in an ordinary call to
List.length(&2, String, String.lines(text)).README.mdCHANGELOG.mdBoth files end with a newline. The counts include the final empty field, as specified by
String.lines.The JavaScript backend now splits strings and counts list elements with loops. The splitter advances one Bend character at a time. This preserves separators next to empty fields and prevents matches inside a packed character. The regression test also checks partial application and the Base reduction for
String.splitonSCon.I ran the new regression and six related fixtures on the Bend CLI, generated JavaScript under Node and Bun, and native CPU. All seven passed on each path. The repository gate passed 56/56.
Related to #798.