diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2023-01-23 14:29:27 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-01-25 12:23:15 +0100 |
commit | 049022370c4aa268d597993dcfb37624b732b602 (patch) | |
tree | d648ad2107b563a5baea0d0b151b60a0b53078ec | |
parent | 21e9b2f62c858182e3bd44b9c50d7e6d327e12d6 (diff) |
QmlCompiler: Wrap sequences with unknown elemnts in QVariantList
Otherwise we later try to perform value type lookups on them. That won't
work.
Task-number: QTBUG-110438
Fixes: QTBUG-110315
Change-Id: I1690a3375841ba5a1ff1a471a7f88bd2023ab4c4
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c9b8b061170ab3974754249f8bb1d3356c839fd1)
-rw-r--r-- | src/qmlcompiler/qqmljstyperesolver.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qml/qmlcppcodegen/data/badSequence.qml | 1 | ||||
-rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/src/qmlcompiler/qqmljstyperesolver.cpp b/src/qmlcompiler/qqmljstyperesolver.cpp index 771512c2f6..eeb5f605f0 100644 --- a/src/qmlcompiler/qqmljstyperesolver.cpp +++ b/src/qmlcompiler/qqmljstyperesolver.cpp @@ -760,6 +760,7 @@ QQmlJSScope::ConstPtr QQmlJSTypeResolver::genericType(const QQmlJSScope::ConstPt return type; if (const QQmlJSScope::ConstPtr valueType = type->valueType()) return listType(genericType(valueType), UseQObjectList); + return m_variantListType; } return m_varType; diff --git a/tests/auto/qml/qmlcppcodegen/data/badSequence.qml b/tests/auto/qml/qmlcppcodegen/data/badSequence.qml index 5b0742ab6a..785765ec74 100644 --- a/tests/auto/qml/qmlcppcodegen/data/badSequence.qml +++ b/tests/auto/qml/qmlcppcodegen/data/badSequence.qml @@ -3,4 +3,5 @@ import TestTypes Person { property Person other: Person { id: oo } barzles: oo.barzles + property int l: oo.barzles.length } diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 660ea51978..aa0b8d94f6 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -2375,6 +2375,7 @@ void tst_QmlCppCodegen::badSequence() other->setBarzles(barzles); QCOMPARE(self->barzles(), barzles); + QCOMPARE(self->property("l").toInt(), 2); } void tst_QmlCppCodegen::enumLookup() |