diff options
| author | Olivier De Cannière <olivier.decanniere@qt.io> | 2023-10-05 16:54:03 +0200 |
|---|---|---|
| committer | Olivier De Cannière <olivier.decanniere@qt.io> | 2023-10-06 18:06:47 +0200 |
| commit | d4bab563568a211bf05260fed1b80b4652b20507 (patch) | |
| tree | 05ee1c982ad9e3c60162711f7b212d882b622248 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | |
| parent | f77c59459be7bef325237c87a3441323b160a523 (diff) | |
codegenerator: Convert to the original type of registers for unary ops
When generating the code for unary operations, we converted from the
received type to the expected type in readAccumulator. Except, if the
latter was replaced by a different type such as with a generalization to
QVariant for example, then we would not retrieve the original type the
operations should be performed on but keep the replacement type.
Convert the received type to the original type instead of to the
replacement.
Fixes: QTBUG-117789
Pick-to: 6.6
Change-Id: Ia0109918443b1e1be2bc57b9d46a3a628799806b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index a0e8b3dbbe..9b7eff5507 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -67,6 +67,7 @@ private slots: void contextParam(); void conversionDecrement(); void conversions(); + void convertToOriginalReadAcumulatorForUnaryOperators(); void cppValueTypeList(); void dateConstruction(); void dateConversions(); @@ -1231,6 +1232,15 @@ void tst_QmlCppCodegen::conversions() QVERIFY(!undef.isValid()); } +void tst_QmlCppCodegen::convertToOriginalReadAcumulatorForUnaryOperators() +{ + QQmlEngine engine; + QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/convertToOriginalReadAcumulatorForUnaryOperators.qml"_s)); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> o(c.create()); + QVERIFY(!o.isNull()); +} + void tst_QmlCppCodegen::cppValueTypeList() { QQmlEngine engine; |
