aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qmlcompiler/qqmljsimportvisitor.cpp18
-rw-r--r--tests/auto/qml/qmllint/tst_qmllint.cpp4
-rw-r--r--tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp2
3 files changed, 12 insertions, 12 deletions
diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp
index 7ed433706f..8b9c94e2a9 100644
--- a/src/qmlcompiler/qqmljsimportvisitor.cpp
+++ b/src/qmlcompiler/qqmljsimportvisitor.cpp
@@ -107,6 +107,12 @@ inline QString getScopeName(const QQmlJSScope::ConstPtr &scope, QQmlJSScope::Sco
|| type == QQmlSA::ScopeType::AttachedPropertyScope)
return scope->internalName();
+ if (!scope->isComposite())
+ return scope->internalName();
+
+ if (scope->isInlineComponent() && scope->inlineComponentName().has_value())
+ return scope->inlineComponentName().value();
+
return scope->baseTypeName();
}
@@ -1000,16 +1006,12 @@ void QQmlJSImportVisitor::checkRequiredProperties()
return false;
};
- const auto warn = [this](const QList<QQmlJSScope::ConstPtr> scopesToSearch,
- QQmlJSScope::ConstPtr prevRequiredScope,
+ const auto warn = [this](QQmlJSScope::ConstPtr prevRequiredScope,
const QString &propName,
QQmlJSScope::ConstPtr defScope,
QQmlJSScope::ConstPtr requiredScope,
QQmlJSScope::ConstPtr descendant) {
- const QQmlJSScope::ConstPtr propertyScope = scopesToSearch.size() > 1
- ? scopesToSearch.at(scopesToSearch.size() - 2)
- : QQmlJSScope::ConstPtr();
-
+ const auto &propertyScope = QQmlJSScope::ownerOfProperty(requiredScope, propName).scope;
const QString propertyScopeName = !propertyScope.isNull()
? getScopeName(propertyScope, QQmlSA::ScopeType::QMLScope)
: u"here"_s;
@@ -1088,9 +1090,7 @@ void QQmlJSImportVisitor::checkRequiredProperties()
if (requiredSetThroughAlias(scopesToSearch, requiredScope, propName))
continue;
- warn(scopesToSearch, prevRequiredScope, propName, defScope,
- requiredScope, descendant);
-
+ warn(prevRequiredScope, propName, defScope, requiredScope, descendant);
prevRequiredScope = requiredScope;
}
}
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp
index b9521861ae..2d9717fd8e 100644
--- a/tests/auto/qml/qmllint/tst_qmllint.cpp
+++ b/tests/auto/qml/qmllint/tst_qmllint.cpp
@@ -1311,7 +1311,7 @@ expression: \${expr} \${expr} \\\${expr} \\\${expr}`)",
<< Result {{ Message { QStringLiteral("Unqualified access") }}};
QTest::newRow("missingRequiredOnObjectDefinitionBinding")
<< QStringLiteral("missingRequiredPropertyOnObjectDefinitionBinding.qml")
- << Result{ { { uR"(Component is missing required property i from here)"_s, 4, 26 } } };
+ << Result{ { { uR"(Component is missing required property i from QtObject)"_s, 4, 26 } } };
QTest::newRow("PropertyAliasCycles") << QStringLiteral("settings/propertyAliasCycle/file.qml")
<< Result::cleanWithSettings();
@@ -2381,7 +2381,7 @@ void TestQmllint::requiredProperty()
Result { { Message { QStringLiteral("Component is missing required property "
"required_now_string from Base") },
Message { QStringLiteral("Component is missing required property "
- "required_defined_here_string from here") } } });
+ "required_defined_here_string from Derived") } } });
runTest("requiredPropertyBindingsLater.qml",
Result { { Message { QStringLiteral("Component is missing required property "
"required_later_string from "
diff --git a/tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp b/tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp
index 13b2caa330..becc8c602f 100644
--- a/tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp
+++ b/tests/auto/qml/qmltc_qprocess/tst_qmltc_qprocess.cpp
@@ -360,7 +360,7 @@ void tst_qmltc_qprocess::innerLevelRequiredProperty()
{
const auto errors = runQmltc(u"innerLevelRequiredProperty.qml"_s, false);
QVERIFY(errors.contains(
- u"innerLevelRequiredProperty.qml:7:5: Component is missing required property foo from here [required]"
+ u"innerLevelRequiredProperty.qml:7:5: Component is missing required property foo from Item [required]"
));
}
}