Fix code completion for nameless structs/unions with the same member
The code completion always shows the first declaration it finds for a matching name.
This works fine as long as the parent has a name, for nameless structs/unions it just returns the first declaration it finds.
Fix this by checking that the found declaration has the expected type.
See https://bugs.kde.org/show_bug.cgi?id=409041 for example code
or see the unit test in this patch.
Reviewers: KDevelop, apol
Reviewed By: KDevelop, apol
Differential Revision: https://phabricator.kde.org/D22455