From a5cb71925c31593e9d71a3e4ac621d3120311199 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 4 Feb 2025 12:01:46 +0100 Subject: QmlCompiler: Tighten detection of assignment to unknown properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While those properties may be of type Component, they don't have to. We can in fact not resolve anything resembling an ID while inside one of those objects because we cannot determine the component boundaries. Amends commit dea8e38d95508acd67da997d0c2a9c91ef1bc887 Pick-to: 6.9 6.8 Fixes: QTBUG-133460 Change-Id: Iac7294166d38ce591c45c0d31b139a52eda70fc1 Reviewed-by: Fabian Kosmale Reviewed-by: Olivier De Cannière --- tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp') diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 7bbaa0ec19..0ca624134e 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -260,6 +260,7 @@ private slots: void typePropagationLoop(); void typePropertyClash(); void typedArray(); + void unclearComponentBoundaries(); void undefinedResets(); void undefinedToDouble(); void unknownAttached(); @@ -5318,6 +5319,19 @@ void tst_QmlCppCodegen::typedArray() QCOMPARE(result, 20); } +void tst_QmlCppCodegen::unclearComponentBoundaries() +{ + QQmlEngine engine; + QQmlComponent component( + &engine, QUrl(u"qrc:/qt/qml/TestTypes/unclearComponentBoundaries.qml"_s)); + + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer rootObject(component.create()); + QVERIFY(rootObject); + + QCOMPARE(rootObject->objectName(), u"outer"_s); +} + void tst_QmlCppCodegen::undefinedResets() { QQmlEngine engine; -- cgit v1.2.3