Git commit 7f9caec4d88c2f6fb3bf29f8d777b1e9c1f44d13 by Niko Sams. Committed on 17/11/2013 at 12:55. Pushed by nsams into branch 'master'. Improve completion: don't filter abstract methods It makes sense in theory to filter them because they can't be called, but i= n pratice abstract methods are overridden in a class and the base methods can call th= ose. Fixes completion for methods that have an interface as @return typehint. M +0 -8 completion/context.cpp M +18 -2 completion/tests/test_completion.cpp M +1 -0 completion/tests/test_completion.h http://commits.kde.org/kdev-php/7f9caec4d88c2f6fb3bf29f8d777b1e9c1f44d13 diff --git a/completion/context.cpp b/completion/context.cpp index da088ba..435428a 100644 --- a/completion/context.cpp +++ b/completion/context.cpp @@ -1408,14 +1408,6 @@ QList CodeCompletionConte= xt::completionItems(bool& ab } } = - // filter abstract methods - if (filterAbstract) { - ClassFunctionDeclaration* method =3D dynamic_cast<= ClassFunctionDeclaration*>(decl.first); - if (method && method->isAbstract()) { - continue; - } - } - if (!decl.first->identifier().isEmpty()) items << CompletionTreeItemPointer( new NormalDeclarationCompletionItem( diff --git a/completion/tests/test_completion.cpp b/completion/tests/test_c= ompletion.cpp index 2dcb8d5..6e4a816 100644 --- a/completion/tests/test_completion.cpp +++ b/completion/tests/test_completion.cpp @@ -626,7 +626,7 @@ void TestCompletion::abstractMethods() = DUContext* funContext =3D top->childContexts().first()->localDeclarati= ons().last()->internalContext(); PhpCompletionTester tester(funContext, "$this->"); - QCOMPARE(tester.names, QStringList() << "bar"); + QCOMPARE(tester.names, QStringList() << "foo" << "bar"); } = void TestCompletion::interfaceMethods() @@ -641,8 +641,24 @@ void TestCompletion::interfaceMethods() = DUContext* funContext =3D top->childContexts().last()->localDeclaratio= ns().first()->internalContext(); PhpCompletionTester tester(funContext, "$this->"); - QCOMPARE(tester.names, QStringList() << "bar"); + QCOMPARE(tester.names, QStringList() << "bar" << "foo"); } + +void TestCompletion::interfaceMethods2() +{ + // 0 1 2 3 4 5= 6 7 + // 012345678901234567890123456789012345678901234567890= 12345678901234567890123456789 + QByteArray method(""); + QCOMPARE(tester.names, QStringList() << "foo"); +} + void TestCompletion::implementMethods() { // 0 1 2 3 4 5= 6 7 diff --git a/completion/tests/test_completion.h b/completion/tests/test_com= pletion.h index b0d29ef..56fe20a 100644 --- a/completion/tests/test_completion.h +++ b/completion/tests/test_completion.h @@ -65,6 +65,7 @@ private slots: void exceptionOtherFile(); void abstractMethods(); void interfaceMethods(); + void interfaceMethods2(); void overrideMethods(); void implementMethods(); void inArray();