Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@amoilanen
Copy link

@amoilanen amoilanen commented Aug 8, 2021

There might be a typo in the inheritRefs example from the documentation https://zio.dev/docs/datatypes/fiber/fiberref#inheritrefs:

val withoutJoin =
  for {
    fiberRef <- FiberRef.make[Int](0)
    fiber    <- fiberRef.set(10)
    v        <- fiberRef.get
  } yield assert(v == 10)

in this example the fiber is not forked and the type of fiber is Unit, also inheritRefs is not called.

While the value of v will still be 10 and the example will pass, it might not demonstrate how to call inheritRefs manually.

Tried to fix the example by forking a fiber and using inheritRefs (as explained in the documentation I read before this example), tested the updated example locally and it passes as expected.

Copy link
Contributor

@adamgfraser adamgfraser left a comment

Choose a reason for hiding this comment

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

Thank you! 🙏

@adamgfraser adamgfraser merged commit 3f4c95a into zio:master Aug 8, 2021
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.

2 participants