forked from qt-creator/qt-creator
CPlusPlus: Support completion of list iterators
Fixes: QTCREATORBUG-30608 Change-Id: I169efe675e13540ecc5fbbd6b15dd13d8522db7d Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -1062,6 +1062,8 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
||||
}
|
||||
|
||||
typedefsResolver.resolve(&ty, &scope, r.binding());
|
||||
if (auto ref = ty->asReferenceType()) // deref if needed
|
||||
ty = ref->elementType();
|
||||
|
||||
if (Q_UNLIKELY(debug))
|
||||
qDebug() << "- after typedef resolving:" << oo.prettyType(ty);
|
||||
@@ -1082,6 +1084,9 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
||||
if (ClassOrNamespace *binding = findClass(type, scope))
|
||||
return binding;
|
||||
|
||||
if (ClassOrNamespace *binding = findClass(type, r.scope())) // local classes and structs
|
||||
return binding;
|
||||
|
||||
} else {
|
||||
ClassOrNamespace *binding
|
||||
= findClassForTemplateParameterInExpressionScope(r.binding(),
|
||||
@@ -1176,6 +1181,9 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
|
||||
|
||||
if (ClassOrNamespace *binding = findClass(ty, scope, enclosingBinding))
|
||||
return binding;
|
||||
|
||||
if (ClassOrNamespace *binding = findClass(ty, r.scope())) // local classes and structs
|
||||
return binding;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2889,6 +2889,16 @@ void CompletionTest::testCompletionMemberAccessOperator_data()
|
||||
) << _("p->") << QStringList({"S", "m"})
|
||||
<< false
|
||||
<< false;
|
||||
QTest::newRow("dot to arrow: template + reference + double typedef")
|
||||
<< _("template <typename T> struct C {\n"
|
||||
" using ref = T &;\n"
|
||||
" ref operator[](int i);\n"
|
||||
"};\n"
|
||||
"struct S { int m; };\n"
|
||||
"template<typename T> using CS = C<T>;\n"
|
||||
"CS<S *> v;\n"
|
||||
"@\n")
|
||||
<< _("v[0].") << QStringList({"S", "m"}) << false << true;
|
||||
}
|
||||
|
||||
} // namespace CppEditor::Internal
|
||||
|
||||
Reference in New Issue
Block a user