aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2015-03-11 13:45:11 +0100
committerNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2015-03-13 13:41:08 +0000
commit251b444cfd4618d49135458f0d9a766e43c8309f (patch)
treeaaacd899d74f1a7cb118595dae946f5832fa9c59 /src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
parent3ab5e5231c14717bb9e5a3f003e662d74f972b3f (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.cpp5
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()