diff options
-rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/hangOnWarning.qml | 3 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 12 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index c7343e709c..dd2a5fc970 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -443,7 +443,9 @@ bool IRBuilder::generateFromQml(const QString &code, const QString &url, Documen errors << m; } - return false; + + if (!errors.isEmpty() || !parseResult) + return false; } program = parser.ast(); Q_ASSERT(program); diff --git a/tests/auto/qml/qqmllanguage/data/hangOnWarning.qml b/tests/auto/qml/qqmllanguage/data/hangOnWarning.qml new file mode 100644 index 0000000000..51943c3839 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/hangOnWarning.qml @@ -0,0 +1,3 @@ +import QtQml 2.15 + +QtObject["foobar"] {} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index f058b97605..b5bc1d72ac 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -356,6 +356,8 @@ private slots: void qtbug_85615(); + void hangOnWarning(); + private: QQmlEngine engine; QStringList defaultImportPathList; @@ -6276,6 +6278,16 @@ void tst_qqmllanguage::bareInlineComponent() QVERIFY(tab1Found); } +void tst_qqmllanguage::hangOnWarning() +{ + QTest::ignoreMessage(QtWarningMsg, + qPrintable(QStringLiteral("%1:3 : Ignored annotation") + .arg(testFileUrl("hangOnWarning.qml").toString()))); + QQmlComponent component(&engine, testFileUrl("hangOnWarning.qml")); + QScopedPointer<QObject> object(component.create()); + QVERIFY(object != nullptr); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" |