Fixed #3806: Update AccessibleMacro to properly handle ZManaged #3807
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First off, this is my first PR to zio, so please let me know if I am not following proper procedures or if there is anything else I should have done to be a better contributor. I am also only a week or so into using zio, so feedback about better ways to accomplish my goals is also very welcome.
When a module has a member with a return type of
ZManaged[R, E, A], I think the expected accessor generated by @accessible would beZManaged[R with Has[Service], E, A], but the current implementation seems to fall back to treating it as a method and generates an accessor with return typeZIO[Has[Service], Throwable, ZManaged[R, E, A]]which is more difficult to work with and doesn't match the API provided by the other ZIO classes.This PR addresses the issue by adding in specific handling for
ZManagedinAccessibleMacro, in a way that mostly mirrors the wayZIOitself is handled (thoughZManaged.accessMdoesn't compose the same way, so I had to use a slightly different approach there.) I was mostly just following the example of the surrounding code, which was fairly easy to follow, especially for macro code. I added tests to verify the new behavior and make sure that it had coverage similar to the level of the effect types.Let me know if anything looks improper and I am happy to fix it. Thanks!