Skip to content

Upgrade BuildFrom to the latest definition from 2.13 #200

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
Apr 25, 2019

Conversation

szeiger
Copy link
Contributor

@szeiger szeiger commented Apr 23, 2019

No description provided.

@@ -41,7 +39,7 @@ object BuildFrom {
implicit def fromCanBuildFrom[From, A, C](
implicit cbf: CanBuildFrom[From, A, C]): BuildFrom[From, A, C] =
new BuildFrom[From, A, C] {
def fromSpecificIterable(from: From)(it: Iterable[A]): C = (cbf(from) ++= it).result()
def fromSpecific(from: From)(it: IterableOnce[A]): C = (cbf(from) ++= it).result()
Copy link
Member

Choose a reason for hiding this comment

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

Are there any test coverage for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a test to ensure that a BuildFrom implementation compiles on all versions.

@szeiger szeiger force-pushed the wip/fix-buildfrom branch from 903a6fa to 413c4f3 Compare April 24, 2019 10:13
@szeiger
Copy link
Contributor Author

szeiger commented Apr 24, 2019

I ran a test of Slick with this PR. As expected no code changes were necessary and everything worked fine. The old code was based on CanBuildFrom so it only uses the strict portions of BuildFrom for now, and it only uses provided instances but doesn't have to implement BuildFrom itself. It does implement Factory, which requires different source codes for 2.11/2.11 and 2.13, but that's unavoidable if we want to keep Factory as a simple type alias for CanBuildFrom instead of providing another class for it.

@szeiger szeiger merged commit 2f821c3 into scala:master Apr 25, 2019
@szeiger szeiger deleted the wip/fix-buildfrom branch April 25, 2019 10:45
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