Skip to content
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

Start cross-compiling pureconfig-core to Scala 3.0.0-M2 #891

Merged
merged 29 commits into from Dec 18, 2020

Conversation

jcazevedo
Copy link
Member

Depends on #890.

This PR starts cross-compiling pureconfig-core to Scala 3.0.0-M2.

This makes the Derivation macro a no-op in Scala 3. I'm not sure we should implement it with Scala 3 macros, since errors in implicit chains are much better now, pointing the user to the most specific implicit argument that was missing in the implicit search. I'm actually inclined to drop it entirely, since the Derivation type leaks into PureConfig's external API, the macro is hard to maintain and we can recommend users in Scala 2 to use splain for better implicit not found errors. @leifwickland and @ruippeixotog: If you agree with this, I'll open a separate PR to remove the Derivation type and update the documentation to provide a guide to using splain for debugging implicit not found errors.

My plan is to follow-up with the necessary updates to support generic derivation of ConfigReader and ConfigWriter instances in another PR, hopefully still during this week. I think we should be able to support this directly in pureconfig-core using the type class derivation features of Scala 3 (and taking advantage of the derives machinery). We probably still want to keep pureconfig-generic for compatibility purposes and to provide the configuration mechanisms for derivation we currently support with hints.

Copy link
Member

@ruippeixotog ruippeixotog left a comment

Choose a reason for hiding this comment

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

Thanks for doing this, I'm excited to start supporting Scala 3.0! Apart from one comment regarding failWithType the code changes look good to me, but I think we need to simplify the build.

core/build.sbt Outdated Show resolved Hide resolved
core/build.sbt Outdated Show resolved Hide resolved
build.sbt Outdated Show resolved Hide resolved
build.sbt Outdated Show resolved Hide resolved
build.sbt Outdated Show resolved Hide resolved
tests/build.sbt Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
@ruippeixotog
Copy link
Member

Regarding Derivation I'm up for deprecating it 👍 I'm happy to know better implicit explanation is being introduced in Scala 3 and splain is becoming a mature option, as this shouldn't be left to libraries like PureConfig anyway and the current approach is rather hacky.

build.sbt Outdated Show resolved Hide resolved
testkit/build.sbt Show resolved Hide resolved
build.sbt Outdated Show resolved Hide resolved
build.sbt Outdated Show resolved Hide resolved
Copy link
Member

@ruippeixotog ruippeixotog left a comment

Choose a reason for hiding this comment

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

Thanks @jcazevedo!

@ruippeixotog ruippeixotog merged commit 9589882 into master Dec 18, 2020
@ruippeixotog ruippeixotog deleted the scala-3-pureconfig-core branch December 18, 2020 18:49
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.

None yet

2 participants