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

Stub layer's Any type for E is unexpected #222

Closed
gannicottb opened this issue May 18, 2021 · 3 comments
Closed

Stub layer's Any type for E is unexpected #222

gannicottb opened this issue May 18, 2021 · 3 comments

Comments

@gannicottb
Copy link

While using this library's stub layer for writing specs, I noticed something odd.

def stub(path: ZPath): ZLayer[Blocking, Any, S3] =
    ZLayer.fromFunction(Test.connect(path))

The E type is Any, which is a widening from the E of ZLayer.fromFunction, which is Nothing - the function provided to fromFunction is meant to be total. The consequence of this is that it is impossible to eliminate the error type of the stub layer with .orDie (as we do for our other test layers). I see that your in your tests you use .mapError to transform the Any to TestFailure[Any], but that's not ergonomic for our code. I'm just curious about the motivation behind this design decision; maybe I'm just confused.

Thanks!

@regis-leray
Copy link
Member

Wrong IDE type resolution :)
Thanks again for reporting the issue.

@regis-leray
Copy link
Member

#223

@gannicottb
Copy link
Author

Wow, thank you so much for the quick turnaround! :)

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

No branches or pull requests

2 participants