Conversation
Previously, calling `String.IndexOf("s", StringComparison.Ordinal)` in
Python would either produce a compile error (three-arg form) or silently
misinterpret the StringComparison enum value as a start-index (two-arg
form, since the enum int value is passed to `find()`).
Add pattern cases to filter out the StringComparison argument, matching
the approach used in the JS/TS target. Also add regression tests.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
Python Type Checking Results (Pyright)
Excluded files with errors (4 files)These files have known type errors and are excluded from CI. Remove from
|
93 tasks
Replace 4 duplicated match arms with List.filter to strip StringComparison args before pattern matching, matching the JS/TS target's approach. Add IndexOf char with StringComparison test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…son-2026-03-548762428ccbf4c1
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 PR was created by Repo Assist, an automated AI assistant.
Summary
String.IndexOf(str, StringComparison)in Python: theStringComparisonenum value was being passed through to Python'sstr.find()as a start-index, silently producing wrong results (e.g."abcdbc".IndexOf("b", StringComparison.Ordinal)returned4instead of1)String.IndexOf(str, startIndex, StringComparison)in Python: previously caused a compile error ("The only extra argument accepted…")String.LastIndexOftests/Python/TestString.fsRoot cause: The Python
Replacements.fspattern-matched on argument types but had no cases forStringComparisonenum values, so(String, Ordinal)matched the(String, Int32)pattern (treating the enum as a start-index) and(String, Int32, Ordinal)fell through to the error case.Fix approach: Mirror the JS/TS target: detect
StringComparisonEnumValueargs and filter them out before calling the underlying Python method.Ordinalis the default Python string comparison, so this is semantically correct forOrdinal. Note thatOrdinalIgnoreCaseis still not supported (same limitation as JS/TS — requires a separate implementation).Test plan
./build.sh test pythonto verify the four new tests passRelated
src/Fable.Transforms/Replacements.fs(JS/TS) forIndexOf/LastIndexOfwithStringComparison🤖 Generated with [Claude Code]((claude.ai/redacted)
Note
🔒 Integrity filtering filtered 183 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".)