Bug fix for wrong output parameters being copied #1008
Merged
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.
It's been a long time since my last contributions, but I've finally managed to get some free time and I've spend it in finishing the modifications that I started to enable expected calls to match multiple calls. I'm still merging all the changes of the main branch into my outdated code (almost a year full of commits!), but I've detected a bug that I've just fixed, so I'm submitting this standalone PR for it.
Here goes the bug description and fixing notes:
The present code can copy the output parameters of an expected call, but finally fulfill a different one.
This happens for example if an expected call for a function that returns output parameters and ignores other parameters is declared before an expected call for the same function, that also returns expected parameters, but that doesn't ignore parameters.
The solution has been to just prioritize output parameter finalization of expected calls that don't ignore parameters over calls that can ignore them (in the same way that call fulfillment works), instead of just picking the first one.
BTW, some optimizations have been also applied on the affected code, to avoid traversing the expected calls list twice (first to check if there is a call that matches some criteria, then again to get that call), and therefore some methods that are not necessary any more have been deleted.