aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qqmlpropertyvalidator.cpp3
-rw-r--r--tests/auto/qml/qqmllanguage/data/wrongType.16.errors.txt2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/compiler/qqmlpropertyvalidator.cpp b/src/qml/compiler/qqmlpropertyvalidator.cpp
index 8ebd2da1c9..afa2e4ad81 100644
--- a/src/qml/compiler/qqmlpropertyvalidator.cpp
+++ b/src/qml/compiler/qqmlpropertyvalidator.cpp
@@ -693,7 +693,8 @@ QQmlCompileError QQmlPropertyValidator::validateObjectBinding(QQmlPropertyData *
}
if (!isAssignable) {
- return QQmlCompileError(binding->valueLocation, tr("Cannot assign object to property"));
+ return QQmlCompileError(binding->valueLocation, tr("Cannot assign object of type \"%1\" to property of type \"%2\" as the former is neither the same as the latter nor a sub-class of it.")
+ .arg(stringAt(qmlUnit->objectAt(binding->value.objectIndex)->inheritedTypeNameIndex)).arg(QLatin1String(QMetaType::typeName(property->propType()))));
}
}
return noError;
diff --git a/tests/auto/qml/qqmllanguage/data/wrongType.16.errors.txt b/tests/auto/qml/qqmllanguage/data/wrongType.16.errors.txt
index 77cf210918..cedae349d2 100644
--- a/tests/auto/qml/qqmllanguage/data/wrongType.16.errors.txt
+++ b/tests/auto/qml/qqmllanguage/data/wrongType.16.errors.txt
@@ -1 +1 @@
-4:24:Cannot assign object to property
+4:24:Cannot assign object of type "QtObject" to property of type "MyQmlObject*" as the former is neither the same as the latter nor a sub-class of it.