Skip to content

Avoid recursive inlining (for products) #575

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

Draft
wants to merge 3 commits into
base: scala3
Choose a base branch
from

Conversation

MartinHH
Copy link

Leverage summonAll to avoid recursive inlining as proposed in #574

So far, this is just a proof of concept.

Various tests are still failing - most of them are related to error messages of compilation errors not being as expected, but
one ("derive instances for types with refined types if implicit provided") seems a bit more serious (compilation fails when it shouldn't).

Leverage summonAll instead of recursion.
@MartinHH
Copy link
Author

MartinHH commented Feb 16, 2025

"derive instances for types with refined types if implicit provided"

Turns out that one doesn't fail when changing the project's scala version to 3.4.0 (and the unexpected error messages from the other failing tests are also much closer to the expected ones).

Maybe it would make sense to postpone this change until the next LTS version (3.7.0) is out and Magnolia is migrated to that (?).

@@ -96,6 +96,18 @@ object CaseClassDerivation:
} { params => product.fromProduct(Tuple.fromArray(params)) }
}

private trait ParamFactory[TC[_], P]:
Copy link
Author

Choose a reason for hiding this comment

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

This is where one would need to add an @implicitNotFound annotation in order to fix the failing tests related to (compilation) error messages.

Something along the lines of:

@implicitNotFound("No given instance of type ${TC} (for type ${P}) was found")

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.

1 participant