Skip to content

refactor(js/ts/python): use struct partial active patterns and postfix array syntax#4569

Merged
dbrattli merged 5 commits into
mainfrom
repo-assist/codescan-1056-1181-struct-patterns-postfix-array-55a4df7673eab1db
Apr 26, 2026
Merged

refactor(js/ts/python): use struct partial active patterns and postfix array syntax#4569
dbrattli merged 5 commits into
mainfrom
repo-assist/codescan-1056-1181-struct-patterns-postfix-array-55a4df7673eab1db

Conversation

@fable-repo-assist

Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Fixes code scanning alerts from Ionide.Analyzers (IONIDE-009 and IONIDE-002):

Files Changed

File Change
src/Fable.Transforms/BabelPrinter.fs [<return: Struct>] on UndefinedOrVoid, NullOrUndefinedOrVoid, StringConstant; TypeParameter array
src/Fable.Transforms/Python/Fable2Python.Util.fs [<return: Struct>] on Function, IEnumerableOfKeyValuePair; Fable.Ident array
src/Fable.Transforms/Python/Fable2Python.Transforms.fs [<return: Struct>] on UsePattern
src/Fable.Transforms/Python/Python.AST.fs byte array

Notes

These are purely cosmetic/performance changes with no semantic impact. Struct partial active patterns work identically in match expressions; callers do not need to change.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@51c8f6ad4357d2ecc06e47120031b3d75e80227d

github-actions Bot and others added 4 commits April 25, 2026 10:14
…ectly converted (#4560)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Dag Brattli <dag@brattli.net>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fix code scanning alerts IONIDE-009 (alerts #1056-#1058, #1069-#1070, #1083)
and IONIDE-002 (alerts #1065, #1072, #1181).

- Add [<return: Struct>] to partial active patterns in BabelPrinter.fs and
  Python transforms to avoid heap allocation for option types
- Replace [] postfix array syntax with the idiomatic 'array' postfix syntax
  in BabelPrinter.fs, Fable2Python.Util.fs, and Python.AST.fs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@fable-repo-assist fable-repo-assist Bot added automation Automated changes optimization repo-assist Created by Repo Assist labels Apr 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Python Type Checking Results (Pyright)

Metric Value
Total errors 33
Files with errors 4
Excluded files 4
New errors ✅ No
Excluded files with errors (4 files)

These files have known type errors and are excluded from CI. Remove from pyrightconfig.ci.json as errors are fixed.

File Errors Status
temp/tests/Python/test_hash_set.py 18 Excluded
temp/tests/Python/test_applicative.py 12 Excluded
temp/tests/Python/test_nested_and_recursive_pattern.py 2 Excluded
temp/tests/Python/fable_modules/thoth_json_python/encode.py 1 Excluded

@dbrattli dbrattli changed the title style: use struct partial active patterns and postfix array syntax style(js/ts/python): use struct partial active patterns and postfix array syntax Apr 26, 2026
@dbrattli dbrattli marked this pull request as ready for review April 26, 2026 13:47
@dbrattli dbrattli changed the title style(js/ts/python): use struct partial active patterns and postfix array syntax refactor(js/ts/python): use struct partial active patterns and postfix array syntax Apr 26, 2026
@dbrattli dbrattli closed this Apr 26, 2026
@dbrattli dbrattli reopened this Apr 26, 2026
@dbrattli dbrattli merged commit 77e85bc into main Apr 26, 2026
69 of 72 checks passed
@dbrattli dbrattli deleted the repo-assist/codescan-1056-1181-struct-patterns-postfix-array-55a4df7673eab1db branch April 26, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation Automated changes optimization repo-assist Created by Repo Assist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant