-
Notifications
You must be signed in to change notification settings - Fork 173
Type Parameter Resolution Combinations #543
Conversation
…t during its construction, making the class immutable after it is constructed.
cesarzc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and seems like it will be very useful to have this logic as a separate class.
bettinaheim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that this functionality is properly split out, you should replace the corresponding implementation in the ClassicallyControlled transformation and the Monomorphization (and later the CallGraph) with it. If you prefer to do this in a separate PR, then please retarget this to a feature branch - we shouldn't have redundant implementations.
The changes to ClassicallyControlled were already done in a branch under the CallGraph feature branch, so it is was easy and small enough to migrate those into this PR. I can't immediately see any changes to be done to the Monomorphization transformation with regards to this utility. The Monomorphization will need to be heavily changed once the call graph is ready anyway, so it might not be a big deal to leave it as it is for now. |
The additions from the call graph branch for ClassicallyControlled includes a new static member of TypedExpression called |
Thanks for pointing it out! |
bettinaheim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had one more question that came to my mind, but otherwise looks good!
Adding a utility class,
TypeResolutionSummaryTypeResolutionCombination, that can be used tosummarizecombine the effect of multiple type parameter resolution dictionaries into one resolution dictionary. Thissummarizingcombination is calculated during the construction of thesesummaryobjects and the resultingsummariescombinations are immutable. Validation for the given resolutions is also done during construction and can be check by referencing theIsValidSummaryIsValid flag.There are two constructors for the class. The first one takes an arbitrary list of resolution dictionaries that is expected be given in a specific order. It will construct a different
summarycombination if the input is in an unexpected order and validation is likely to fail. This constructor is internal only as it is likely that only the call graph will make use of it. The second constructor takes a TypedExpression object and collects all the relevant type parameter resolutions by walking the expression. It can then just use the logic from the first constructor to build thesummarycombination. This constructor is public as it will be used in the runtime repo.In total there are 4 public members to the combination object: