forked from qt-creator/qt-creator
Revert "C++: fix support for typedef of templated typedefs"
Still crashes when opening the Qt Creator project,
g++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2 (Ubuntu 12.10).
This reverts commit 564c9b2842.
Change-Id: Ief5c0aad463d245f68805f747d277ac298796c3d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
@@ -1882,138 +1882,3 @@ void CppToolsPlugin::test_completion_QTCREATORBUG9098()
|
||||
QVERIFY(completions.contains(QLatin1String("c")));
|
||||
QVERIFY(completions.contains(QLatin1String("B")));
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_typedef_of_templated_typedef_QTCREATORBUG8375()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText =
|
||||
"struct Foo\n"
|
||||
"{ void bar(); };\n"
|
||||
"struct A\n"
|
||||
"{ typedef Foo AFoo; };\n"
|
||||
"template <class T>\n"
|
||||
"struct B\n"
|
||||
"{ typedef typename T::AFoo BFoo; };\n"
|
||||
"struct C : public B<A>\n"
|
||||
"{\n"
|
||||
" void test()\n"
|
||||
" {\n"
|
||||
" BFoo foo;\n"
|
||||
" @\n"
|
||||
" // padding so we get the scope right\n"
|
||||
" }\n"
|
||||
"};\n"
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("foo.");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
QStringList completions = getCompletions(data);
|
||||
|
||||
QCOMPARE(completions.size(), 2);
|
||||
QVERIFY(completions.contains(QLatin1String("Foo")));
|
||||
QVERIFY(completions.contains(QLatin1String("bar")));
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_typedef_with_the_same_base_name_and_new_type_name()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText =
|
||||
"namespace A\n"
|
||||
"{\n"
|
||||
"struct A { int aa; };\n"
|
||||
"}\n"
|
||||
"struct S\n"
|
||||
"{\n"
|
||||
" typedef A::A A;\n"
|
||||
" A a;\n"
|
||||
"};\n"
|
||||
"void fun()\n"
|
||||
"{\n"
|
||||
" S s;\n"
|
||||
" @\n"
|
||||
" // padding so we get the scope right\n"
|
||||
"};\n"
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("s.a.");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
QStringList completions = getCompletions(data);
|
||||
|
||||
QCOMPARE(completions.size(), 2);
|
||||
QVERIFY(completions.contains(QLatin1String("A")));
|
||||
QVERIFY(completions.contains(QLatin1String("aa")));
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_qualified_typedef_1()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText =
|
||||
"struct S\n"
|
||||
"{\n"
|
||||
" typedef S::type type;\n"
|
||||
"};\n"
|
||||
"void fun()\n"
|
||||
"{\n"
|
||||
" @\n"
|
||||
" // padding so we get the scope right\n"
|
||||
"};\n"
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("S::");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
QStringList completions = getCompletions(data);
|
||||
|
||||
QCOMPARE(completions.size(), 2);
|
||||
QVERIFY(completions.contains(QLatin1String("S")));
|
||||
QVERIFY(completions.contains(QLatin1String("type")));
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_qualified_typedef_2()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText =
|
||||
"template <typename T>\n"
|
||||
"struct S\n"
|
||||
"{\n"
|
||||
" typedef S<T>::type type;\n"
|
||||
"};\n"
|
||||
"void fun()\n"
|
||||
"{\n"
|
||||
" @\n"
|
||||
" // padding so we get the scope right\n"
|
||||
"};\n"
|
||||
;
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("S<int>::");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
QStringList completions = getCompletions(data);
|
||||
|
||||
QCOMPARE(completions.size(), 2);
|
||||
QVERIFY(completions.contains(QLatin1String("S")));
|
||||
QVERIFY(completions.contains(QLatin1String("type")));
|
||||
}
|
||||
|
||||
|
||||
@@ -124,11 +124,6 @@ private slots:
|
||||
void test_completion_typedef_using_templates2();
|
||||
void test_completion_namespace_alias_with_many_namespace_declarations();
|
||||
void test_completion_QTCREATORBUG9098();
|
||||
void test_completion_typedef_of_templated_typedef_QTCREATORBUG8375();
|
||||
void test_completion_typedef_with_the_same_base_name_and_new_type_name();
|
||||
void test_completion_qualified_typedef_1();
|
||||
void test_completion_qualified_typedef_2();
|
||||
|
||||
|
||||
void test_format_pointerdeclaration_in_simpledeclarations();
|
||||
void test_format_pointerdeclaration_in_simpledeclarations_data();
|
||||
|
||||
Reference in New Issue
Block a user