Commit 2e91dd1f authored by Nikolai Kosjar's avatar Nikolai Kosjar

C++: Fix matching NamedType

NamedType::isEqualTo() wasn't properly moved to Matcher.

In the test case, the function argument matching was failing.

Change-Id: Ia3cb82c11b039ddea61a41d9574f56d43da16ed0
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent d9ba7998
......@@ -159,7 +159,15 @@ bool Matcher::match(const NamedType *type, const NamedType *otherType)
if (type == otherType)
return true;
else if (! Matcher::match(type->name(), otherType->name(), this))
const Name *name = type->name();
if (const QualifiedNameId *q = name->asQualifiedNameId())
name = q->name();
const Name *otherName = otherType->name();
if (const QualifiedNameId *q = otherName->asQualifiedNameId())
otherName = q->name();
if (! Matcher::match(name, otherName, this))
return false;
return true;
......
......@@ -962,6 +962,16 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_multipleDocuments_data()
"void Foo::$foo(int) {}\n",
"foo.cpp")
);
QTest::newRow("matchFunctionSignature2") << (QList<TestDocumentPtr>()
<< TestDocument::create("namespace N { class C; }\n"
"bool *@fun(N::C *) const;\n",
"foo.h")
<< TestDocument::create("#include \"foo.h\"\n"
"using namespace N;\n"
"bool *$fun(C *) const {}\n",
"foo.cpp")
);
}
void CppEditorPlugin::test_FollowSymbolUnderCursor_multipleDocuments()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment