(PUP-2344) Fix issue with inter-module calls (visibility error) #2568
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes the problem where inter-module function calls could
not be made. The main problem was that a function when loaded
was given the public loader and thus had no visibility into its
containing module's dependencies.
The design is that module resolution should be on-demand, only
when something actually needs the proviate loader should it be resolved.
The resolution is triggered by asking for the private loader, but no
such call was made on the call-path when a function was loaded.
This commit adds the notion of private_loader to the loaders (those that
do not have one respond with self). Those that do either provide the
private loader explicitly (environment loader), or on demand (by
obtaining the private loader from loaders).
This change required tests to be modified since the logic now depends
on :loaders being bound in the Puppet context
logic that made this happen on demand was not implemented