Conversation
…patterns - Replace unsafe `.Value` on option types with safe pattern matching in Python/Replacements.fs (#1203) and Rust/Fable2Rust.fs (#1126, #1127) - Add [<return: Struct>] to partial active patterns in Dart/Fable2Dart.fs (#1105, #1106), Dart/Replacements.fs (#1177), and Rust/Fable2Rust.fs (#1115, #1116, #1117, #1118, #1119, #1120, #1121, #1122, #1123, #1124) to reduce heap allocations Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The repo-assist PR added [<return: Struct>] to partial active patterns but didn't update the bodies from Some/None to ValueSome/ValueNone. Also expand or-patterns for struct active patterns (DartInt | DartDouble) since F# doesn't allow struct active patterns in or-patterns, and pipe Seq.tryPick through Option.toValueOption for Rust active patterns. 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
|
dbrattli
approved these changes
Apr 2, 2026
…2-00f2663-aae0bff37b25caec
…2-00f2663-aae0bff37b25caec
ncave
approved these changes
Apr 3, 2026
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.
Summary
Fixes multiple open code scanning alerts from the Ionide analyzer:
IONIDE-006 (warning): Unsafe option unwrapping
src/Fable.Transforms/Python/Replacements.fs— alert #1203:thisArg.Valuereplaced withthisArg |> Option.map (fun this -> ...)to safely handle theNonecasesrc/Fable.Transforms/Rust/Fable2Rust.fs— alerts #1126, #1127:name.Valuereplaced with explicitmatchon(isTailRec, name)/(isRecursive && not isTailRec, name). In practice these values can never beNonewhen the guard is true (sinceisTailRecursivereturnsfalse, falsewhennameisNone), but the explicit pattern match makes the invariant visible to both humans and the analyzer.IONIDE-009 (note): Missing
[(return: Struct)]on partial active patternsAdds
[(return: Struct)]to partial active patterns in:src/Fable.Transforms/Dart/Fable2Dart.fs—(|Function|_|)and(|Lets|_|)(alerts #1105, #1106)src/Fable.Transforms/Dart/Replacements.fs—(|DartInt|_|)and(|DartDouble|_|)(alert #1177)src/Fable.Transforms/Rust/Fable2Rust.fs—(|HasEmitAttribute|_|),(|HasReferenceTypeAttribute|_|),(|IsNonErasedInterface|_|),(|Function|_|),(|Lets|_|),(|IDisposable|_|),(|IFormattable|_|),(|IComparable|_|),(|IEquatable|_|),(|IEnumerable|_|)(alerts #1115–#1124)The
[(return: Struct)]attribute changes the internal return type fromOption(T)toValueOption(T), reducing heap allocations for these frequently-called patterns. Callers that use them in pattern matching require no changes — the F# compiler handles the conversion transparently.Test plan
🤖 Generated with Repo Assist
Note
🔒 Integrity filtering filtered 11 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_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)issue_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)