(PUP-5929) Add mapping between runtime classes and puppet types #4883
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 PR adds the ability to create mappings between runtime types (here, only ruby since the runtime is ruby) and types in the Puppet Type system. Mappings are declared using an alias like expression where the left hand side is a Runtime type (either a single type or array with regex + replacement) and the right hand side is either a Puppet type or an array with regex + replacement.
A mapping is registered in string form in the new class
ImplementationRegistry
. A loader (the effective loader at the place where the mapping occurs) is also part of the mapping. This means that the singleton registry will be able to produce a Type from a Runtime (or vice versa) from any place in the code. This is necessary since no loader is present in the majority of cases. TheTypeCalculator
in particular, have no access to a loader instance and it must be able to produce types from a mapping when type inference is performed.