Improve qml error message "invalid alias location"
authorAleix Pol <aleixpol@kde.org>
Wed, 10 Jun 2015 19:18:15 +0000 (21:18 +0200)
committerAleix Pol Gonzalez <aleixpol@kde.org>
Wed, 10 Jun 2015 19:44:05 +0000 (19:44 +0000)
Specify we're talking about the target itself rather than talking
location, which I always doubt about whether it's the location within the
file.
Also specify the offending property, so we get a clue about what to look
into.

[ChangeLog][QtQml] Improve "invalid alias location" error message by specifying
what's the offending property and by calling it "invalid alias target location"

Change-Id: I7a9390089ee8986872c119df44d8036bf267ab99
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
src/qml/compiler/qqmltypecompiler.cpp
tests/auto/qml/qqmllanguage/data/invalidAlias.10.errors.txt
tests/auto/qml/qqmllanguage/data/invalidAlias.6.errors.txt
tests/auto/qml/qqmllanguage/data/invalidAlias.7.errors.txt
tests/auto/qml/qqmllanguage/data/invalidAlias.8.errors.txt
tests/auto/qml/qqmllanguage/data/invalidAlias.9.errors.txt

index 21846775a30d57ae1771437cf43c62ec71fc2f0e..46b67d598385a6cd640e3eb485cc6a0b042acac0 100644 (file)
@@ -1622,7 +1622,7 @@ bool QQmlComponentAndAliasResolver::resolveAliases()
 
                 QQmlPropertyData *targetProperty = resolver.property(property.toString());
                 if (!targetProperty || targetProperty->coreIndex > 0x0000FFFF) {
-                    recordError(p->aliasLocation, tr("Invalid alias location"));
+                    recordError(p->aliasLocation, tr("Invalid alias target location: %1").arg(property.toString()));
                     return false;
                 }
 
@@ -1636,7 +1636,7 @@ bool QQmlComponentAndAliasResolver::resolveAliases()
                 if (!subProperty.isEmpty()) {
                     const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(type);
                     if (!valueTypeMetaObject) {
-                        recordError(p->aliasLocation, tr("Invalid alias location"));
+                        recordError(p->aliasLocation, tr("Invalid alias target location: %1").arg(subProperty.toString()));
                         return false;
                     }
 
@@ -1645,7 +1645,7 @@ bool QQmlComponentAndAliasResolver::resolveAliases()
                     int valueTypeIndex =
                         valueTypeMetaObject->indexOfProperty(subProperty.toString().toUtf8().constData());
                     if (valueTypeIndex == -1) {
-                        recordError(p->aliasLocation, tr("Invalid alias location"));
+                        recordError(p->aliasLocation, tr("Invalid alias target location: %1").arg(subProperty.toString()));
                         return false;
                     }
                     Q_ASSERT(valueTypeIndex <= 0x0000FFFF);
index 93652a7042497559ee2e1b0534fd9ea7fd4f1fae..1ac78f2fc22c78b0962e9b465307fc9c778c201f 100644 (file)
@@ -1 +1 @@
-5:23:Invalid alias location
+5:23:Invalid alias target location: blah
index 93652a7042497559ee2e1b0534fd9ea7fd4f1fae..5b467ebc31fd52645c4ab0ddb81d601e2d831cb5 100644 (file)
@@ -1 +1 @@
-5:23:Invalid alias location
+5:23:Invalid alias target location: foobar
index 93652a7042497559ee2e1b0534fd9ea7fd4f1fae..8334f30ede79d03f67cc578560cddfe8ffae543d 100644 (file)
@@ -1 +1 @@
-5:23:Invalid alias location
+5:23:Invalid alias target location: nonScriptable
index 93652a7042497559ee2e1b0534fd9ea7fd4f1fae..c77182f3bab9c079c7b0bfadf4849e3bb41845c7 100644 (file)
@@ -1 +1 @@
-5:23:Invalid alias location
+5:23:Invalid alias target location: imaginary
index 93652a7042497559ee2e1b0534fd9ea7fd4f1fae..33ba4d293ec007a6c4718e1d9d7d32927757d882 100644 (file)
@@ -1 +1 @@
-5:23:Invalid alias location
+5:23:Invalid alias target location: x