diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-05-04 15:23:18 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-05-04 16:44:44 +0200 |
commit | af618915b14c43af15fbd002568d1f88af4dbe20 (patch) | |
tree | d04d043012fe20cb0125b60d9bfbab474b141475 /tests/auto | |
parent | 4634b6bf54e5ba15aa2e8efc12feb156e3d9c309 (diff) | |
download | qtdeclarative-af618915b14c43af15fbd002568d1f88af4dbe20.tar.gz |
qmllint: Do not crash on invalid alias
We handle already multiple invalid alias constructs, but the case where
the alias is illegal without being an expression was not handled so far.
Pick-to: 6.5
Change-Id: If85bc4b61f645a8f1eff3afa4da394c7373d8d53
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qml/qmllint/data/badAliasNotAnExpression.qml | 8 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/badAliasNotAnExpression.qml b/tests/auto/qml/qmllint/data/badAliasNotAnExpression.qml new file mode 100644 index 0000000000..cdc2b28c07 --- /dev/null +++ b/tests/auto/qml/qmllint/data/badAliasNotAnExpression.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 +Item { + + property alias innerObj: { + id: inner + } + +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index c4726e2708..56705712d0 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -463,6 +463,12 @@ void TestQmllint::dirtyQmlCode_data() QStringLiteral("Invalid alias expression. Only IDs and field member " "expressions can be aliased"), 5, 26 } } }; + QTest::newRow("badAliasNotAnExpression") + << QStringLiteral("badAliasNotAnExpression.qml") + << Result { { Message { + QStringLiteral("Invalid alias expression. Only IDs and field member " + "expressions can be aliased"), + 4, 30 } } }; QTest::newRow("aliasCycle1") << QStringLiteral("aliasCycle.qml") << Result { { Message { QStringLiteral("Alias \"b\" is part of an alias cycle"), |