Skip to content

[All] Fix missing HashSet implementations and tests - #4526

Merged
ncave merged 5 commits into
fable-compiler:mainfrom
ncave:hashset
Apr 13, 2026
Merged

ncave merged 5 commits into
fable-compiler:mainfrom
ncave:hashset

Conversation

@ncave

@ncave ncave commented Apr 11, 2026

Copy link
Copy Markdown
Collaborator
  • [All] Fix missing HashSet implementations and tests

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fills in missing HashSet surface-area across multiple Fable targets (TypeScript/JS, Python, Dart, Beam, Rust) and expands the corresponding test suites to cover the newly supported operations and constructor overloads.

Changes:

  • Add/enable HashSet operations across targets (e.g., CopyTo, Overlaps, SetEquals, SymmetricExceptWith, subset/superset relations, capacity ctor handling).
  • Update runtime/library helpers to implement the new HashSet behaviors (TS Set.fs, Python map_util.py, Dart Types.dart, Beam fable_hashset.erl).
  • Expand target-specific test suites to validate the added HashSet functionality, including custom comparer scenarios where supported.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
tests/Rust/tests/src/HashSetTests.fs Refactors custom comparer helper and adds subset/superset tests.
tests/Python/TestHashSet.fs Enables custom-comparer IntersectWith and adds coverage for more HashSet operations incl. CopyTo and subset/superset.
tests/Js/Main/HashSetTests.fs Adds JS-side tests for newly supported HashSet operations and capacity ctor.
tests/Dart/src/HashSetTests.fs Enables/extends Dart-side HashSet tests to cover missing operations and comparer scenarios.
tests/Beam/HashSetTests.fs Adds Beam-side tests for additional HashSet ops (and documents comparer limitations).
src/Fable.Transforms/Replacements.fs JS/TS replacement layer: supports capacity ctor and adds missing method replacements (CopyTo, Overlaps, SetEquals, SymmetricExceptWith).
src/Fable.Transforms/Python/Replacements.fs Python replacement layer: supports capacity ctor and maps missing HashSet methods to map_util helpers.
src/Fable.Transforms/Dart/Replacements.fs Dart replacement layer: supports capacity ctor and routes more HashSet methods to Types.dart helpers.
src/Fable.Transforms/Beam/Replacements.fs Beam replacement layer: adds missing HashSet method replacements and richer CopyTo overload support.
src/Fable.Compiler/CHANGELOG.md Changelog entry for the cross-target HashSet fixes.
src/Fable.Cli/CHANGELOG.md Changelog entry for the cross-target HashSet fixes.
src/fable-library-ts/Set.fs Fixes isProperSupersetOf and adds symmetricExceptWith, overlaps, setEquals, copyToArray helpers.
src/fable-library-py/fable_library/Set.fs Fixes isProperSupersetOf for Python mutable sets.
src/fable-library-py/fable_library/map_util.py Enhances set helpers to preserve custom comparers and adds missing HashSet-style operations.
src/fable-library-dart/Types.dart Implements Dart-side HashSet operations and CopyTo support for custom-comparer sets.
src/fable-library-beam/fable_hashset.erl Adds Beam-side HashSet operations (symmetric_except_with, overlaps, set_equals) and expands copy_to overloads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/Python/TestHashSet.fs Resolved
Comment thread tests/Python/TestHashSet.fs Resolved
Comment thread tests/Js/Main/HashSetTests.fs Resolved
Comment thread tests/Js/Main/HashSetTests.fs Resolved
Comment thread tests/Dart/src/HashSetTests.fs Resolved
Comment thread tests/Dart/src/HashSetTests.fs Resolved
Comment thread tests/Rust/tests/src/HashSetTests.fs Resolved
Comment thread tests/Beam/HashSetTests.fs Resolved
Comment thread tests/Beam/HashSetTests.fs Resolved
@ncave

ncave commented Apr 11, 2026 •

Copy link
Copy Markdown
Collaborator Author
Test Rust Beam Dart JS/TS Python
HashSet ctor creates empty HashSet ✅ ✅ ✅ ✅ ✅
HashSet ctor with capacity works ✅ ✅ ✅ ✅ ✅
HashSet ctor from Enumerable works ✅ ✅ ✅ ✅ ✅
HashSet with IEqualityComparer works ✅ ☐ ✅ ✅ ✅
HashSet.Add returns true if not present ✅ ✅ ✅ ✅ ✅
HashSet.Add returns false if already present ✅ ✅ ✅ ✅ ✅
HashSet.Add works ✅ ✅ ✅ ✅ ✅
HashSet.Add works II ✅ ✅ ✅ ✅ ✅
HashSet.Add with records works ✅ ✅ ✅ ✅ ✅
HashSet.Add with reference records works ✅ ☐ ☐ ☐ ☐
HashSet.Remove works when item is present ✅ ✅ ✅ ✅ ✅
HashSet.Remove works when item is not present ✅ ✅ ✅ ✅ ✅
HashSet.Remove works ✅ ✅ ✅ ✅ ✅
HashSet.Remove with records works ✅ ✅ ✅ ✅ ✅
HashSet.Contains works ✅ ✅ ✅ ✅ ✅
HashSet.Contains works II ✅ ✅ ✅ ✅ ✅
HashSet.Count works ✅ ✅ ✅ ✅ ✅
HashSet.Count works II ✅ ✅ ✅ ✅ ✅
HashSet.Clear works ✅ ✅ ✅ ✅ ✅
HashSet.CopyTo works ✅ ✅ ✅ ✅ ✅
HashSet.UnionWith works ✅ ✅ ✅ ✅ ✅
HashSet.IntersectWith works ✅ ✅ ✅ ✅ ✅
HashSet.IntersectWith works with custom comparison ✅ ☐ ✅ ✅ ✅
HashSet.ExceptWith works ✅ ✅ ✅ ✅ ✅
HashSet.ExceptWith works with custom comparison ✅ ☐ ✅ ✅ ✅
HashSet.SymmetricExceptWith works ✅ ✅ ✅ ✅ ✅
HashSet.SymmetricExceptWith works with custom comparison ✅ ☐ ✅ ✅ ✅
HashSet.Overlaps works ✅ ✅ ✅ ✅ ✅
HashSet.Overlaps works with custom comparison ✅ ☐ ✅ ✅ ✅
HashSet.SetEquals works ✅ ✅ ✅ ✅ ✅
HashSet.SetEquals works with custom comparison ✅ ☐ ✅ ✅ ✅
HashSet.IsSubsetOf works ✅ ✅ ✅ ✅ ✅
HashSet.IsSupersetOf works ✅ ✅ ✅ ✅ ✅
HashSet.IsProperSubsetOf works ✅ ✅ ✅ ✅ ✅
HashSet.IsProperSupersetOf works ✅ ✅ ✅ ✅ ✅
HashSet iteration works ✅ ✅ ✅ ✅ ✅
HashSet folding works ✅ ✅ ✅ ✅ ✅
HashSet equality works with generics ✅ ✅ ✅ ✅ ✅
HashSet IReadOnlyCollection.Count works ☐ ☐ ☐ ✅ ☐
HashSet ICollection.IsReadOnly works ☐ ☐ ☐ ✅ ☐
HashSet ICollection.Count works ☐ ☐ ☐ ✅ ☐
HashSet ICollection.Contains works ☐ ☐ ☐ ✅ ☐
HashSet ICollection.CopyTo works ☐ ☐ ☐ ✅ ☐
HashSet ICollection.Clear works ☐ ☐ ☐ ✅ ☐
HashSet ICollection.Add works ☐ ☐ ☐ ✅ ☐
HashSet ICollection.Remove works ☐ ☐ ☐ ✅ ☐
Target Status Details
JavaScript Passed .NET: 2723, transpiled JS: 2895, React: 24
TypeScript Passed 2705 tests passing
Python Passed .NET: 2244, transpiled Python: 2328
Dart Passed 1286 tests passing
Rust Passed 2271 passed, 0 failed, 1 ignored
BEAM Passed 2436 passed, 0 failed
Integration Passed Expecto: 36 and 101 passed
Standalone Passed 2889 tests passing

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/fable-library-dart/Types.dart Resolved
Comment thread src/fable-library-dart/Types.dart Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Fable.Transforms/Rust/Fable2Rust.fs Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/fable-library-ts/Set.fs Resolved
@ncave
ncave merged commit 81b0286 into fable-compiler:main Apr 13, 2026
24 checks passed
@ncave
ncave deleted the hashset branch April 13, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants