qmllint: Fix QQmlComponent default property incompatible type warnings
Assigning any element to a QQmlComponent property implictly wraps it into a Component. Thus checking for compatible types does not make sense here. Fixes: QTBUG-92571 Change-Id: Id72f69d30d8506193c52a51b038b9c218ac85917 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
45aa0853da
commit
1c0e771197
|
@ -0,0 +1,5 @@
|
|||
import QtQuick
|
||||
|
||||
Repeater {
|
||||
QtObject {}
|
||||
}
|
|
@ -620,6 +620,7 @@ void TestQmllint::cleanQmlCode_data()
|
|||
QTest::newRow("var") << QStringLiteral("var.qml");
|
||||
QTest::newRow("defaultProperty") << QStringLiteral("defaultProperty.qml");
|
||||
QTest::newRow("defaultPropertyList") << QStringLiteral("defaultPropertyList.qml");
|
||||
QTest::newRow("defaultPropertyComponent") << QStringLiteral("defaultPropertyComponent.qml");
|
||||
QTest::newRow("duplicateQmldirImport") << QStringLiteral("qmldirImport/duplicate.qml");
|
||||
QTest::newRow("Used imports") << QStringLiteral("used.qml");
|
||||
QTest::newRow("Unused imports (multi)") << QStringLiteral("unused_multi.qml");
|
||||
|
|
|
@ -176,6 +176,10 @@ void FindWarningVisitor::checkDefaultProperty(const QQmlJSScope::ConstPtr &scope
|
|||
if (!propType) // should be an error somewhere else
|
||||
return;
|
||||
|
||||
// Assigning any element to a QQmlComponent property implicitly wraps it into a Component
|
||||
if (defaultProp.typeName() == QStringLiteral("QQmlComponent"))
|
||||
return;
|
||||
|
||||
// scope's type hierarchy has to have property type
|
||||
for (const QQmlJSScope *type = scope.data(); type; type = type->baseType().data()) {
|
||||
if (type == propType)
|
||||
|
|
Loading…
Reference in New Issue