diff options
| -rw-r--r-- | src/qmllint/qqmljslintertypepropagator.cpp | 2 | ||||
| -rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/qmllint/qqmljslintertypepropagator.cpp b/src/qmllint/qqmljslintertypepropagator.cpp index d522186803..0c01baf5fd 100644 --- a/src/qmllint/qqmljslintertypepropagator.cpp +++ b/src/qmllint/qqmljslintertypepropagator.cpp @@ -140,7 +140,7 @@ void QQmlJSLinterTypePropagator::checkWrite(const QQmlJSRegisterContent &callBas if (m_typeResolver->memberType(callBase, propertyName).isProperty()) return; auto containedType = callBase.containedType(); - if (!containedType) + if (!containedType || !checkTypeResolved(containedType)) return; const QString internalName = callBase.containedType()->internalName(); if (internalName == "QJSValue"_L1 || internalName == "QVariant"_L1) diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 9a96c211bf..8ec2bc5071 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -4529,6 +4529,32 @@ Item { .addUnexpected("Type \"MyObject1\" of property \"myObj\" not found."_L1) .build() << defaultOptions; + + QTest::newRow("propertyWriteUsage") + << uR"(import MissingRegistration +import QtQuick +Item { + MyObject1 { id: myObj; } + function f() { myObj.hello = 42; } +})"_s + << ResultBuilder() + .addExpected("MyObject1 was not found"_L1, 4, 5) + .addUnexpected("Member \"hello\" not found on type"_L1) + .build() + << defaultOptions; + + QTest::newRow("propertyWriteUsage2") + << uR"(import MissingRegistration +import QtQuick +Item { + property MyObject1 myObj + function f() { myObj.hello = 42; } +})"_s + << ResultBuilder() + .addExpected("MyObject1 was not found"_L1, 4, 5) + .addUnexpected("Member \"hello\" not found on type"_L1) + .build() + << defaultOptions; } void TestQmllint::missingRegistration() |
