aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-02-24 08:56:56 +0100
committerUlf Hermann <ulf.hermann@qt.io>2022-02-24 12:16:41 +0100
commit78e3b774ad2a29e5d29029935661c362ee7e1a92 (patch)
tree7fea205c2ea1cc013d91b2a26b1c5ca6129564bf
parenta7925b9a7dc43661cd1d9835b91088142bf77816 (diff)
QmlCompiler: Don't assert for the "int" type if we don't need it
If there are no enums in a type, we don't need the int type to resolve them. This is commonly the case for sequence types. Change-Id: I18b2960ef845ef797b6ef6d755648e6add1854db Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--src/qmlcompiler/qqmljsscope.cpp2
-rw-r--r--tests/auto/qml/qmlcppcodegen/data/typedArray.qml1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/qmlcompiler/qqmljsscope.cpp b/src/qmlcompiler/qqmljsscope.cpp
index bb7bd58919..24f1ba6687 100644
--- a/src/qmlcompiler/qqmljsscope.cpp
+++ b/src/qmlcompiler/qqmljsscope.cpp
@@ -446,11 +446,11 @@ void QQmlJSScope::resolveNonEnumTypes(
void QQmlJSScope::resolveEnums(const QQmlJSScope::Ptr &self, const QQmlJSScope::ConstPtr &intType)
{
- Q_ASSERT(intType); // There always has to be a builtin "int" type
for (auto it = self->m_enumerations.begin(), end = self->m_enumerations.end(); it != end;
++it) {
if (it->type())
continue;
+ Q_ASSERT(intType); // We need an "int" type to resolve enums
auto enumScope = QQmlJSScope::create(EnumScope, self);
enumScope->m_baseTypeName = QStringLiteral("int");
enumScope->m_baseType.scope = intType;
diff --git a/tests/auto/qml/qmlcppcodegen/data/typedArray.qml b/tests/auto/qml/qmlcppcodegen/data/typedArray.qml
index d2ab3d6f1b..0072357ae3 100644
--- a/tests/auto/qml/qmlcppcodegen/data/typedArray.qml
+++ b/tests/auto/qml/qmlcppcodegen/data/typedArray.qml
@@ -2,5 +2,6 @@ pragma Strict
import QtQml
QtObject {
+ property list<bool> values1: []
property list<int> values2: []
}