typelevel / cats-effect

The pure asynchronous runtime for Scala
https://typelevel.org/cats-effect/
Apache License 2.0
2.01k stars 515 forks source link

Custom `IOApp#runtime` is not installed as `IORuntime.global` #3140

Closed armanbilge closed 2 years ago

armanbilge commented 2 years ago

The scaladoc specifically says that IOApp#runtime is guaranteed to be equal to IORuntime.global.

https://github.com/typelevel/cats-effect/blob/3da61a59438da30f9bb01192fec9e690aacc3ce4/core/jvm/src/main/scala/cats/effect/IOApp.scala#L157-L159

However, if runtime is overridden by the user, then it will not be installed as the global IORuntime.

https://github.com/typelevel/cats-effect/blob/3da61a59438da30f9bb01192fec9e690aacc3ce4/core/jvm/src/main/scala/cats/effect/IOApp.scala#L307-L310

It's not clear to me if this is a documentation bug, or a code bug.

Context:

djspiewak commented 2 years ago

Oh, this seems like a code bug to me. Should be fixed.