From d97ff367c292ca8ac65c06fb9699558da7d21bd4 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 8 Apr 2021 12:52:34 +0200 Subject: qmllint: Initialize special casing for QString on checkMemberAccess() If the very first component in the member access chain is already a QString, we need to expect "length" as only valid property from the beginning. Like we do for lists. Task-number: QTBUG-92447 Change-Id: I4549f4da52cb1c0968b24813f0a921a129da28ee Reviewed-by: Fabian Kosmale --- tools/qmllint/checkidentifiers.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools/qmllint/checkidentifiers.cpp') diff --git a/tools/qmllint/checkidentifiers.cpp b/tools/qmllint/checkidentifiers.cpp index 911e08034a..208f44e51b 100644 --- a/tools/qmllint/checkidentifiers.cpp +++ b/tools/qmllint/checkidentifiers.cpp @@ -81,6 +81,9 @@ void CheckIdentifiers::checkMemberAccess(const QVector &members, if (prop != nullptr && prop->isList()) { detectedRestrictiveKind = QLatin1String("list"); expectedNext.append(QLatin1String("length")); + } else if (outerScope->internalName() == QLatin1String("QString")) { + detectedRestrictiveKind = QLatin1String("QString"); + expectedNext.append(QLatin1String("length")); } QQmlJSScope::ConstPtr scope = outerScope; -- cgit v1.2.3