aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2021-04-27 16:47:55 +0200
committerMaximilian Goldstein <max.goldstein@qt.io>2021-04-28 09:57:55 +0200
commit4c8fc3ecf12b7b83f28c24ebf0432e5a8b4215e8 (patch)
tree4c7d5153ef129fcb5db6ccbfccf3e81843e540b4 /tools
parent73148c79a328cb834a51de5c152f32851194ce52 (diff)
qmllint: Fix false positive warnings for non-list default property
We stored whether something was assigned a default property in the scope the property stems from rather than the one where it occurs. This leads to issues when two destinct elements both share the same base type and want to assign a default property. Task-number: QTBUG-93189 Change-Id: I0560a0ffc6f83849333f8f5fad8e760bd05bec9a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmllint/findwarnings.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp
index 825baf1be1..36ae2b6dd9 100644
--- a/tools/qmllint/findwarnings.cpp
+++ b/tools/qmllint/findwarnings.cpp
@@ -168,15 +168,17 @@ void FindWarningVisitor::checkDefaultProperty(const QQmlJSScope::ConstPtr &scope
Q_ASSERT(scope->parentScope());
QQmlJSMetaProperty defaultProp = scopeOfDefaultProperty->property(defaultPropertyName);
+ const QQmlJSScope *parentScope = scope->parentScope().get();
+
// abuse QHash feature to construct default value through
// operator[]. default bool is false, which is what's needed
- if (m_scopeHasDefaultPropertyAssignment[scopeOfDefaultProperty] && !defaultProp.isList()) {
+ if (m_scopeHasDefaultPropertyAssignment[parentScope] && !defaultProp.isList()) {
// already has some object assigned to a default property and
// this default property is not a list property
m_logger.log(QStringLiteral("Cannot assign multiple objects to a default non-list property"),
Log_Property, scope->sourceLocation());
}
- m_scopeHasDefaultPropertyAssignment[scopeOfDefaultProperty] = true;
+ m_scopeHasDefaultPropertyAssignment[parentScope] = true;
auto propType = defaultProp.type();
if (propType.isNull() || !propType->isFullyResolved()