Review Request: Proper auto-completion in switch statements

Ivan Shapovalov intelfx100 at
Wed Jul 4 09:49:34 UTC 2012

This is an automatically generated e-mail. To reply, visit:

(Updated July 4, 2012, 9:49 a.m.)

Review request for KDevelop.


More exhaustive fix + some unit-tests.

Description (updated)

Improve code completion within switch statements.

1) Resolve type of the switch'd expression correctly
 - in switchExpressionType(), replaced evaluateType() with evaluateExpression()

2) Correctly complete code for enumerations (e. g. do not mark type declarations as matching items)
 - this required adding integral constant check in CodeCompletionContext::standardAccessCompletionItems()

3) Add completion items for enumerations declared in different scopes
 - this required adding another condition branch in the end of CodeCompletionContext::standardAccessCompletionItems(),
which in turn required proper setting of m_expressionResult in CaseAccess contexts,
which required moving switchExpressionType() to doCaseCompletion() to avoid code duplication.

Diffs (updated)

  languages/cpp/codecompletion/context.h a5fdea7 
  languages/cpp/codecompletion/context.cpp 33dcad1 
  languages/cpp/tests/test_cppcodecompletion.h 20a70cb 
  languages/cpp/tests/test_cppcodecompletion.cpp ec82d2d 


Testing (updated)

there is a unit-test for change (1),
I don't know how to test (2) and
(3) cannot be tested due to some weird things with CompletionItemTester though it can be tested manually.


Ivan Shapovalov

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the KDevelop-devel mailing list