Handle precedence of generic and target-specific implementations #1430
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.
Fixes #1409
Scenario
It is possible to have a implementation in a derived target which overrides a non-target implementation. The
logic did not try to find implementations with non-empty targets before defaulting to returning an implementation
without a target.
Fix
When dealing with an explicit target on definition search. First test for implementations which have a non-empty target string.
If not found then fallback to non-target implementations. This should fix returning non-target implementations before trying to find implementations with targets.
Test
which creates this documet:
The first test returns "derived" and "base", the second before the change returns "" and "". The derived result is incorrect.
After the change, the derived result is "derived" as expected.
@dcourtois. Can you see if this will fix your issue? Thanks.
@niklasharrysson, @jstone-lucasfilm : This is the least intrusive change I could think of which does not change
the logic of
targetStringsMatch
as that method is used in other places.