diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2022-02-03 14:45:49 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-02-14 12:38:10 +0100 |
| commit | 89b7e8def608906d541e0adfc559a1eedf9358cf (patch) | |
| tree | 305c2ee189fee1f4ee12db47f4c17fbf62c42ead /src/qmlcompiler/qqmljsfunctioninitializer.cpp | |
| parent | 8be258b7e69fdc94a4a6a63d1964d96f8dfcb50e (diff) | |
QmlCompiler: Allow assigning empty lists to list properties
Generate an empty list when creating a list with 0 elements.
Task-number: QTBUG-100157
Change-Id: I3b0fe0b737a8ec5257785ae32231f4b687d3b204
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsfunctioninitializer.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsfunctioninitializer.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/qmlcompiler/qqmljsfunctioninitializer.cpp b/src/qmlcompiler/qqmljsfunctioninitializer.cpp index 8cd3bb3536..7898b25c59 100644 --- a/src/qmlcompiler/qqmljsfunctioninitializer.cpp +++ b/src/qmlcompiler/qqmljsfunctioninitializer.cpp @@ -181,7 +181,11 @@ QQmlJSCompilePass::Function QQmlJSFunctionInitializer::run( } const auto property = m_objectType->property(propertyName); - function.returnType = property.type(); + function.returnType = property.isList() + ? m_typeResolver->listType(property.type()) + : QQmlJSScope::ConstPtr(property.type()); + + if (!function.returnType) { diagnose(u"Cannot resolve property type %1 for binding on %2"_qs.arg( property.typeName(), propertyName), |
