Skip to content

StreamConverters.toScala in 2.12-style #147

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 2 commits into from
May 20, 2019
Merged

Conversation

lrytz
Copy link
Member

@lrytz lrytz commented May 20, 2019

Fixes #144

@lrytz
Copy link
Member Author

lrytz commented May 20, 2019

Review by @dwijnand - you had a case that was affected, no?

Copy link
Member

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

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

Yes, scalacommunitybuild/playframework@2607f07.

Visually comparing a few things this looks to resolve that issue. So LGTM.

@dwijnand
Copy link
Member

In comparing the test case in 2.13.x with the one in master there are a few changes, particularly these kinds of ones:

-      assertEq(vecO, newStream(n).accumulate.to[Vector], s"stream $n to vector")
-      assertEq(vecO, accO.to[Vector], s"stream $n to vector in parallel")
+      assertEq(vecO, newStream(n).accumulate.to(Vector), s"stream $n to vector")
+      assertEq(vecO, accO.to(Vector), s"stream $n to vector in parallel")

See master...lrytz:toScalaTypeParam#diff-fb9126fd878d17950f0dbccaed6d630c.

@lrytz
Copy link
Member Author

lrytz commented May 20, 2019

Thanks for checking. The problem here is that the Accumulator type, when using scala-java8-compat on 2.13, is the one from the 2.13 standard library. So its .to method has the new 2.13 shape, it takes a (non-implicit) factory value parameter.

I'm not sure how we could bridge that gap here, i.e., I don't see a way to make the accumulator.to[Vector] syntax work when using scala-java8-compat on 2.13. However, one could use scala-collection-compat to make the accumulator.to(Vector) syntax work when using scala-java8-compat on 2.12. (scala-collection-compat doesn't add a new to extension method for that, but instead provides implicit conversions from collection companions to CanBuildFrom instances, so that the 2.12 to method can be used in the 2.13 style).

@lrytz lrytz merged commit 23bb43e into scala:2.13.x May 20, 2019
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