Closed JacobOaks closed 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 98.41%. Comparing base (
9e6f6c2
) to head (258fe12
).:exclamation: Current head 258fe12 differs from pull request most recent head 8c372ea
Please upload reports for the commit 8c372ea to get more accurate results.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
fx.Supply
is essentially an API that allows for convenientlyfx.Provide
ing an exact value, rather than a function that will return that value. For example,fx.Provide(func() int { return 5 })
is equivalent tofx.Supply(5)
.fx.Private
allows for usage of a provided constructor's results to be restricted to the current module and its child modules.This PR allows for using
fx.Private
withfx.Supply
as well, so that folks can enjoy the convenience offx.Supply
when they also wish to restrict the usage of the supplied value.Ref #1206
Since the behavior between Supply + Private and Provide + Private should be identical, I opted to generalize the existing
fx.Private
tests to run for both Provide and Supply. This keeps the tests a little more DRY but does complicate them/hurt readability. I feel like this is OK since there are a lot of tests, but I also am the one who wrote the tests, so I am biased regarding its readability. Thus, I am happy to break out Supply + Private into its own tests if folks feel strongly that these tests are hard to read.