From 15b1aaadd2be9acb337b46ff789c1ad9e18436fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20De=20Canni=C3=A8re?= Date: Thu, 8 Feb 2024 09:56:11 +0100 Subject: Compiler: Also check for shadowing on optional lookups Amends: fc4ee77116624c784d8c42f2b8e5dbf2f78b6d89 Pick-to: 6.7 Change-Id: I3f5f2b74e4b89b82e7fb54072091143010bab8aa Reviewed-by: Fabian Kosmale --- tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp | 13 +++++++++++++ 1 file changed, 13 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 1f7e7eeb1f..208ca15444 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -113,6 +113,7 @@ private slots: void getOptionalLookup(); void getOptionalLookup_data(); void getOptionalLookupOnQJSValueNonStrict(); + void getOptionalLookupShadowed(); void globals(); void idAccess(); void ignoredFunctionReturn(); @@ -2127,6 +2128,18 @@ void tst_QmlCppCodegen::getOptionalLookupOnQJSValueNonStrict() QVERIFY(o->property("b").toBool()); } +void tst_QmlCppCodegen::getOptionalLookupShadowed() +{ + QQmlEngine engine; + const QUrl document(u"qrc:/qt/qml/TestTypes/GetOptionalLookupShadowed.qml"_s); + QQmlComponent c(&engine, document); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer o(c.create()); + QVERIFY(o); + + QCOMPARE(o->property("res").toString(), "a"); +} + void tst_QmlCppCodegen::globals() { QQmlEngine engine; -- cgit v1.2.3