Conversation
Without this fix, calling str.IndexOf(sub, StringComparison.Ordinal) would match the generic [ sub; startIdx ] pattern and incorrectly pass the enum integer value (e.g. 4 for Ordinal) as a start index, producing wrong results. The fix adds StringComparison-specific patterns that strip the enum argument before the generic [ sub; startIdx ] pattern, aligning Beam with the existing JS/TS behavior (which also strips StringComparison and uses native ordinal comparison). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
93 tasks
…d approach Consolidate 8 separate match arms into 2 using List.filter to strip StringComparison args, matching the JS/TS target's approach. Also covers Char + StringComparison overloads that were previously unhandled. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
🤖 This is an automated draft PR created by Repo Assist.
Summary
str.IndexOf(sub, StringComparison.Ordinal)in the Beam target was matching the generic[ sub; startIdx ]pattern. TheStringComparisonenum integer value (e.g.4forOrdinal) was being passed as a start index tofable_string:index_of/3, producing wrong results.StringComparisonEnumValue-specific patterns forIndexOfandLastIndexOfbefore the generic two-arg patterns, so theStringComparisonargument is stripped (as in the JS/TS target) and only the substring (and optional start index) is passed to the Erlang library function.tests/Beam/StringTests.fs, mirroring the existing JS tests for this overload.Root Cause
Pattern matching in
Beam/Replacements.fsdid not distinguish betweenstartIdx: intandStringComparison: enumwhen both are passed as the second argument toIndexOf/LastIndexOf. F# pattern matching uses first-match-wins, so the[ sub; StringComparisonEnumValue ]patterns must appear before the[ sub; startIdx ]wildcard patterns.Limitations
Like the JS/TS target, this fix does not implement case-insensitive comparison for
StringComparison.OrdinalIgnoreCase— it strips the comparison argument and uses Beam's default binary (ordinal) comparison. This matches the existing behavior of all other Fable targets.Test plan
./build.sh test beamGenerated by Repo Assist
Note
🔒 Integrity filtering filtered 67 items
Integrity filtering activated and filtered the following items during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.
list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)EntryPoint#2366 (list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)