Skip to content

Fix MapSet.split_with/2 doctest predicate arity#15551

Merged
josevalim merged 1 commit into
elixir-lang:mainfrom
nseaSeb:fix-mapset-split-with-doctest
Jul 8, 2026
Merged

Fix MapSet.split_with/2 doctest predicate arity#15551
josevalim merged 1 commit into
elixir-lang:mainfrom
nseaSeb:fix-mapset-split-with-doctest

Conversation

@nseaSeb

@nseaSeb nseaSeb commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

The second doctest passed a two-element tuple pattern (fn {_k, v} -> ... end) to MapSet.split_with/2, but the predicate receives each set element as its only argument — as the docstring states and the first doctest and implementation (fun.(key)) confirm. The wrong form was a copy of Map.split_with/2 and only went unnoticed because the example uses an empty set, so the predicate is never called. Aligns it with the documented arity.

Assisted-by: Claude Code:claude-opus-4-8

@josevalim

Copy link
Copy Markdown
Member

Let's change the example to not use an empty set perhaps? :)

The second doctest passed a two-element tuple pattern (`fn {_k, v} -> ... end`)
to `MapSet.split_with/2`, but the predicate receives each set element as its
only argument — as the docstring states and the first doctest and
implementation (`fun.(key)`) confirm. The wrong form was a copy of
`Map.split_with/2` and only went unnoticed because the example uses an empty
set, so the predicate is never called. Aligns it with the documented arity.

Assisted-by: Claude Code:claude-opus-4-8
Signed-off-by: nseaSeb <nseaprotector@gmail.com>
@nseaSeb nseaSeb force-pushed the fix-mapset-split-with-doctest branch from ccabf41 to 68e3678 Compare July 8, 2026 08:15
@nseaSeb

nseaSeb commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Good point! Updated to use a non-empty set so the predicate is actually exercised. Thanks a lot @josevalim you make my day!

@josevalim josevalim merged commit 35cceec into elixir-lang:main Jul 8, 2026
15 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants