forked from qt-creator/qt-creator
CppTools: Highlight type for templated using
Task-number: QTCREATORBUG-9944 Change-Id: I614571e05039f24b7d56abdddc15f912581f68f1 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
d004b1b616
commit
588b333669
@@ -1183,8 +1183,9 @@ bool CheckSymbols::isTemplateClass(Symbol *symbol) const
|
|||||||
if (symbol) {
|
if (symbol) {
|
||||||
if (Template *templ = symbol->asTemplate()) {
|
if (Template *templ = symbol->asTemplate()) {
|
||||||
if (Symbol *declaration = templ->declaration()) {
|
if (Symbol *declaration = templ->declaration()) {
|
||||||
if (declaration->isClass() || declaration->isForwardClassDeclaration())
|
return declaration->isClass()
|
||||||
return true;
|
|| declaration->isForwardClassDeclaration()
|
||||||
|
|| declaration->isTypedef();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -994,6 +994,14 @@ void tst_CheckSymbols::test_checksymbols_data()
|
|||||||
<< Use(10, 13, 3, Highlighting::LocalUse)
|
<< Use(10, 13, 3, Highlighting::LocalUse)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
QTest::newRow("template_alias")
|
||||||
|
<< _("template<class T>\n"
|
||||||
|
"using Foo = Bar;\n")
|
||||||
|
<< (QList<Use>()
|
||||||
|
<< Use(1, 16, 1, Highlighting::TypeUse)
|
||||||
|
<< Use(2, 7, 3, Highlighting::TypeUse)
|
||||||
|
);
|
||||||
|
|
||||||
QTest::newRow("using_inside_different_namespace_QTCREATORBUG7978")
|
QTest::newRow("using_inside_different_namespace_QTCREATORBUG7978")
|
||||||
<< _("class My" TEST_UNICODE_IDENTIFIER "Type { int " TEST_UNICODE_IDENTIFIER "Member; };\n"
|
<< _("class My" TEST_UNICODE_IDENTIFIER "Type { int " TEST_UNICODE_IDENTIFIER "Member; };\n"
|
||||||
"void f(My" TEST_UNICODE_IDENTIFIER "Type var" TEST_UNICODE_IDENTIFIER ")\n"
|
"void f(My" TEST_UNICODE_IDENTIFIER "Type var" TEST_UNICODE_IDENTIFIER ")\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user