aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qqmlpropertyvalidator.cpp3
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.10.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidID.10.qml7
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp1
4 files changed, 12 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmlpropertyvalidator.cpp b/src/qml/compiler/qqmlpropertyvalidator.cpp
index 599e79348d..3aa8befa2c 100644
--- a/src/qml/compiler/qqmlpropertyvalidator.cpp
+++ b/src/qml/compiler/qqmlpropertyvalidator.cpp
@@ -293,6 +293,9 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex,
}
if (obj->idNameIndex) {
+ if (populatingValueTypeGroupProperty)
+ return recordError(obj->locationOfIdProperty, tr("Invalid use of id property with a value type"));
+
bool notInRevision = false;
collectedBindingPropertyData << propertyResolver.property(QStringLiteral("id"), &notInRevision);
}
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.10.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidID.10.errors.txt
new file mode 100644
index 0000000000..d9dcb32f8e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.10.errors.txt
@@ -0,0 +1 @@
+4:9:Invalid use of id property with a value type
diff --git a/tests/auto/qml/qqmllanguage/data/invalidID.10.qml b/tests/auto/qml/qqmllanguage/data/invalidID.10.qml
new file mode 100644
index 0000000000..4f1817dba4
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/invalidID.10.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+MyQmlObject {
+ rect {
+ id: notPossible
+ width: 100
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 6a3418f1ab..d08ad47310 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -433,6 +433,7 @@ void tst_qqmllanguage::errors_data()
QTest::newRow("invalidID.7") << "invalidID.7.qml" << "invalidID.7.errors.txt" << false;
QTest::newRow("invalidID.8") << "invalidID.8.qml" << "invalidID.8.errors.txt" << false;
QTest::newRow("invalidID.9") << "invalidID.9.qml" << "invalidID.9.errors.txt" << false;
+ QTest::newRow("invalidID.10") << "invalidID.10.qml" << "invalidID.10.errors.txt" << false;
QTest::newRow("scriptString.1") << "scriptString.1.qml" << "scriptString.1.errors.txt" << false;
QTest::newRow("scriptString.2") << "scriptString.2.qml" << "scriptString.2.errors.txt" << false;