Skip to content

Remove incorrectly placed index methods on Collection#1681

Merged
bioball merged 1 commit into
apple:mainfrom
bioball:fix-collection-methods
Jun 15, 2026
Merged

Remove incorrectly placed index methods on Collection#1681
bioball merged 1 commit into
apple:mainfrom
bioball:fix-collection-methods

Conversation

@bioball

@bioball bioball commented Jun 15, 2026

Copy link
Copy Markdown
Member

These methods aren't implemented in Set, and don't really make sense because Set types can't be accessed by index.

Note: although this removes methods, this actually isn't a breaking change:

  1. Calling Set.findIndex() currently throws an error around "cannot invoke abstract method"
  2. List and Set are the only subclasses of Collection.

The following code isn't breaking at runtime, although static analysis tooling (like our IDE plugins) will now flag this as an error:

myCollection: Collection

idx = myCollection.indexOf(1)

Closes #1682

These methods aren't implemented in `Set`, and don't really make
sense because `Set` types can't be accessed by index.

Note: although this removes methods, this actually isn't a breaking
change:
1. Calling `Set.findIndex()` currently throws an error around "cannot invoke abstract method"
2. `List` and `Set` are the only subclasses of `Collection`.
@bioball bioball merged commit fc8fe86 into apple:main Jun 15, 2026
22 checks passed
@bioball bioball deleted the fix-collection-methods branch June 15, 2026 15:59
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.

Index-based methods on Set aren't implemented

2 participants