diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-01-04 14:35:17 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-01-26 11:42:34 +0100 |
commit | 59d6cf324dfb80febf65dd735990b4e9e3a7e54b (patch) | |
tree | f526786ff4d00410e1035eba9a3382ab095042a1 /tests/auto | |
parent | 0c5821b366ce32472a91c8907432e37e8618847f (diff) |
qmllint: Do not warn when accessing properties of global constructors
We are treating global constructor functions as methods. But while they
are callable, they also have properties that can be accessed.
Accessing those should not trigger any warning. However, prior to this
commit, any property access to a method would yield a warning.
As we don't store the list of known properties in the
jsroot.qmltypes, we cannot really validate them. Moreover, it is also
possilbe to extend the prototypes, so it might never be feasible to
generate warnings.
Thus, for now simply don't create warnings for JS globals in
QQmlJSTypePropagator::isRestricted.
Fixes: QTBUG-109204
Pick-to: 6.5 6.4
Change-Id: I992365ea716827a562886d7204b2401062772f9a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qml/qmllint/data/constructorProperty.qml | 5 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/constructorProperty.qml b/tests/auto/qml/qmllint/data/constructorProperty.qml new file mode 100644 index 0000000000..d7ef884283 --- /dev/null +++ b/tests/auto/qml/qmllint/data/constructorProperty.qml @@ -0,0 +1,5 @@ +import QtQml + +QtObject { + property double f: Number.EPSILON +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 2bfd794162..ce5e24ed5e 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -1198,6 +1198,7 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("qtquickdialog") << QStringLiteral("qtquickdialog.qml"); QTest::newRow("callBase") << QStringLiteral("callBase.qml"); QTest::newRow("propertyWithOn") << QStringLiteral("switcher.qml"); + QTest::newRow("constructorProperty") << QStringLiteral("constructorProperty.qml"); } void TestQmllint::cleanQmlCode() |