diff options
author | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2015-03-11 13:45:11 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2015-03-13 13:41:08 +0000 |
commit | 251b444cfd4618d49135458f0d9a766e43c8309f (patch) | |
tree | aaacd899d74f1a7cb118595dae946f5832fa9c59 /src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp | |
parent | 3ab5e5231c14717bb9e5a3f003e662d74f972b3f (diff) |
CppEditor: Fix Follow Symbol on trailing return type
For the function
auto foo() -> @Foo {}
whereas '@' denotes the cursor position, we detected the expression
under cursor as "foo() -> Foo" and tried to resolve the member "Foo"
within the type of "foo()".
ExpressionUnderCursor can't detect whether we are on a trailing return
type since it only looks at the tokens. Thus, check also the AST.
Task-number: QTCREATORBUG-13096
Change-Id: Ifc14e402fb70e722940e5fa13f1eaaa9973362e4
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp')
-rw-r--r-- | src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp index 6fad7736c8..960ea4cec7 100644 --- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp +++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp @@ -955,6 +955,11 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_data() "class Foo { void $" TEST_UNICODE_IDENTIFIER "(); };\n" "void Foo::@" TEST_UNICODE_IDENTIFIER "() {}\n" ); + + QTest::newRow("trailingReturnType") << _( + "struct $Foo {};\n" + "auto foo() -> @Foo {}\n" + ); } void CppEditorPlugin::test_FollowSymbolUnderCursor() |