Fix code completion for nameless structs/unions with the same member

Authored by buschinski on Jul 19 2019, 5:18 PM.

Description

Fix code completion for nameless structs/unions with the same member

Summary:
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.

BUG: 409041

Test Plan:
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

Subscribers: kdevelop-devel

Tags: KDevelop

Differential Revision: https://phabricator.kde.org/D22455