diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index f801e17ebd..a835624f07 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -421,7 +421,7 @@ void TestQmllint::dirtyQmlCode_data() << false; QTest::newRow("anchors3") << QStringLiteral("anchors3.qml") - << QString() + << QString("Cannot assign binding of type QQuickItem to QQuickAnchorLine") << QString() << false; QTest::newRow("nanchors1") @@ -753,7 +753,6 @@ void TestQmllint::dirtyQmlCode() const QString output = runQmllint(filename, [&](QProcess &process) { QVERIFY(process.waitForFinished()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); - QEXPECT_FAIL("anchors3", "We don't see that QQuickItem cannot be assigned to QQuickAnchorLine", Abort); QEXPECT_FAIL("attachedPropertyAccess", "We cannot discern between types and instances", Abort); QEXPECT_FAIL("attachedPropertyNested", "We cannot discern between types and instances", diff --git a/tools/qmllint/codegen.cpp b/tools/qmllint/codegen.cpp index 343d427c39..4b9137316b 100644 --- a/tools/qmllint/codegen.cpp +++ b/tools/qmllint/codegen.cpp @@ -296,9 +296,9 @@ bool Codegen::generateFunction(const QV4::Compiler::Context *context, Function * for (const QQmlJS::AST::BoundName &argument : qAsConst(arguments)) { if (argument.typeAnnotation) { const auto rawType = m_typeResolver->typeFromAST(argument.typeAnnotation->type); - if (const auto storedType = m_typeResolver->storedType( + if (m_typeResolver->storedType( rawType, QQmlJSTypeResolver::ComponentIsGeneric::Yes)) { - function->argumentTypes.append(storedType); + function->argumentTypes.append(rawType); continue; } else { return error(QStringLiteral("Cannot store the argument type %1.") @@ -323,10 +323,8 @@ bool Codegen::generateFunction(const QV4::Compiler::Context *context, Function * } if (function->returnType) { - if (auto returnType = m_typeResolver->storedType( + if (!m_typeResolver->storedType( function->returnType, QQmlJSTypeResolver::ComponentIsGeneric::Yes)) { - function->returnType = returnType; - } else { return error(QStringLiteral("Cannot store the return type %1.") .arg(function->returnType->internalName())); }