Skip to content

Rewrite for strict reverseMap and filterKeys (fix #85) #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 20, 2018

Conversation

MasseGuillaume
Copy link
Contributor

No description provided.

i.IntMap(d).mapValues(f2) : i.Map[Int, Int]
i.LongMap(d2).mapValues(f2) : i.Map[Long, Int]
i.Map(d).mapValues(id) : i.Map[Int, Int]
m.LongMap(d2).mapValues(f2) : c.Map[Long, Int]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think users would typically expect a m.LongMap[Int] here, instead of upcasting to Map[Long, Int]. If we rewrite m.LongMap(d2).mapValues(f2) to m.LongMap(d2).mapValues(f2).to(LongMap), does that still cross-compile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the test input, I'm ascribing to make sure we preserve the same output type.

Copy link
Contributor Author

@MasseGuillaume MasseGuillaume Jul 20, 2018

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, indeed, the return type is Map. I thought that operation was overridden to refine the return type but that’s not the case. Alright, then!

@julienrf julienrf merged commit ee152e2 into scala:master Jul 20, 2018
martijnhoekstra pushed a commit to martijnhoekstra/scala-collection-compat that referenced this pull request Nov 9, 2022
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