Skip to content

Conversation

@sabiwara
Copy link
Contributor

@sabiwara sabiwara commented Apr 8, 2021

Hi. I just noticed that Enum.dedup/1 isn't working properly on non-list enumerables in the 1.12-rc.0.

[1, 1, 0, 2] |> Stream.map(& &1) |> Enum.dedup()
[1, 1, 0, 2]

After investigating, I realized this was a bug I introduced myself in a previous PR 🙈.
Really sorry for that.

@josevalim
Copy link
Member

Great find, can you please add a test? Thank you!

@sabiwara
Copy link
Contributor Author

sabiwara commented Apr 8, 2021

@josevalim sure! Should I introduce a EnumTest.Stream? Current tests are basically mostly lists, ranges and maps (and this won't work to reproduce this bug)

@josevalim
Copy link
Member

There is no need, just add a "dedup with stream" and we should be good!

@sabiwara
Copy link
Contributor Author

sabiwara commented Apr 8, 2021

Since it is a separate implementation, I just replicated the whole dedup/1 case with streams.
If we cherry pick assertions, I wasn't sure which one to pick or not.
What do you think?

@josevalim josevalim merged commit 06f155e into elixir-lang:master Apr 9, 2021
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

josevalim pushed a commit that referenced this pull request Apr 9, 2021
@sabiwara sabiwara deleted the fix-dedup-bug branch April 9, 2021 13:25
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.

3 participants