-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fixing bug in implementation of makeSome without repeting fresh layers #8850
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
Conversation
@ghostdogpr Would you mind taking a look? Do you think the testing is enough or are there some other use cases that you think should be covered? The |
When I get time, I will try to test that one on my work codebase. Would be nice if others did too @kyri-petrou maybe? |
I am getting false positive warnings like this:
when doing type BaseDependencies = Config with TransactorForCK
trait TransactorForCK { def transactor: Transactor[Task] }
ZLayer.makeSome[BaseDependencies, SomeService] where I am not supplying |
I am not able to create a similar warning. Are there other type of incorrect warnings or are all the same? Would you mind giving a minimal example or some more information? The layers and its
|
It's a little tricky to minimize but I was able to reproduce with this configuration: trait B
val reproducer = ZLayer.makeSome[B, Reproducer.A](Reproducer.live) In another file: object Reproducer {
case class A()
val live: ZLayer[B, Nothing, A] = ???
} Both are under different packages. If I put them together it seems to work. |
@pablf Would love to get this in. Let me know when ready for a final review after fixing @ghostdogpr's reproducer. |
@jdegoes Puzzlingly, I haven't been able to reproduce it yet. I would like to try again this or the following week. @ghostdogpr I don't want to make you lose too much time on this, but if you had already an isolated project with this problem, would you mind sharing it? In the worst case (not being able to reproduce it) I can try to rewrite how the algorithm compares classes so that maybe somehow the bug disappears (I think something like this should be the problem), but it will be tiresome for @ghostdogpr to check it so many times... Sorry for the inconveniences! Let's see if we can get this merged! |
I can't share it, it's my work project 😄 But I don't mind testing again if you have a new version. |
@ghostdogpr I understand. Would you be able to isolate the reproducer in a standalone project apart from your work project? I've tried to reproduce it with different configuration (under different packages) with no luck. If not, can you share build details? Scala version, maybe java version and maybe dependencies or other macro used that could modify something during compilation. If using some version in Scala, the bug doesn't appear, that is also helpful to know. Also, are you able to check if the layer construction works? Because from what I see it triggers a warning, not an error. So if you are able to try it without converting warnings to errors and it creates the appropriate layer, at least we do know that the problem is that some type is expressed by the scala compiler in different ways in different places, which I don't see how to reproduce. |
@ghostdogpr If you want, you can also try this last version. |
Your last commit solves the compile error! |
@ghostdogpr Glad to hear that, thanks! |
@pablf Thank you! Good to merge when conflicts are fixed. |
@pablf Please re-open if you get a chance to fix conflicts! 🙏 |
@pablf I will close this for now, just to clean up the PR pool, but please re-open when you get a chance to fix the conflicts in |
Reimplements #8678 fixing #8767 and adds new tests with different combination of layers to check behaviour.