8000 Ensure ZLayer macros use the trace from implicit scope by joroKr21 · Pull Request #9361 · zio/zio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Ensure ZLayer macros use the trace from implicit scope #9361

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

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

joroKr21
Copy link
Contributor

Fix #9352
/claim #9352

Comment on lines +216 to +231
},
test("takes trace from the implicit scope") {
var numTraces: Int = 0
val layer = {
implicit def trace: Trace = {
numTraces += 1
Trace.empty
}

ZLayer.make[String](
ZLayer.succeed(42),
ZLayer.fromFunction((_: Int).toString)
)
}

assertZIO(layer.build.as(numTraces))(equalTo(3))
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you, at least now I won't have to remember why we had to do use explicit tags in the macros in the future 🥲

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test was really hard to come up with 🤣

@kyri-petrou kyri-petrou merged commit 65a35bc into zio:series/2.x Dec 2, 2024
18 checks passed
@joroKr21 joroKr21 deleted the zlayer/trace branch December 2, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ambiguous implicit value for zio.Trace with ZIO 2.1.13
2 participants
0