aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2015-08-11 11:49:22 +0200
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2015-08-11 13:27:07 +0000
commit6f6a2ef73ef2187b4e57fc8f059f337b04fd22e6 (patch)
tree5e1ce808b00469cddd209c8c9e5362f16cc9975d
parentbc26976698c2ff191788504fa1ef498acb5250e7 (diff)
Emit diagnostics for all types of undeclared properties in Export items.
So far, users only got warnings for invalid property assignments in existing modules, but neither for assignments to non-existing properties in the Export item itself nor for those to properties in unknown modules. Note: The errors we already caught before will now be reported twice. This should ideally be fixed in a follow-up commit. Task-number: QBS-851 Change-Id: Ie00d6af8d5817bb5ecdebf6ffd735b5156b558df Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r--src/lib/corelib/language/moduleloader.cpp7
-rw-r--r--src/lib/corelib/language/testdata/erroneous/undeclared_property_in_export_item3.qbs9
-rw-r--r--src/lib/corelib/language/tst_language.cpp3
3 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp
index ea571721e..4d9e7fb71 100644
--- a/src/lib/corelib/language/moduleloader.cpp
+++ b/src/lib/corelib/language/moduleloader.cpp
@@ -226,6 +226,13 @@ private:
if (child->typeName() != QLatin1String("Export"))
handleItem(child);
}
+
+ // Properties that don't refer to an existing module with a matching Depends item
+ // only exist in the prototype, not in the instance.
+ // Example 1 - setting a property of an unknown module: Export { abc.def: true }
+ // Example 2 - setting a non-existing Export property: Export { blubb: true }
+ if (item->typeName() == QLatin1String("Export") && item->prototype())
+ handleItem(item->prototype());
}
void handle(VariantValue *) { /* only created internally - no need to check */ }
diff --git a/src/lib/corelib/language/testdata/erroneous/undeclared_property_in_export_item3.qbs b/src/lib/corelib/language/testdata/erroneous/undeclared_property_in_export_item3.qbs
new file mode 100644
index 000000000..cd23aefe4
--- /dev/null
+++ b/src/lib/corelib/language/testdata/erroneous/undeclared_property_in_export_item3.qbs
@@ -0,0 +1,9 @@
+import qbs
+
+Project {
+ Product {
+ name: "p1"
+ Export { blubb: false }
+ }
+ Product { Depends { name: "p1" } }
+}
diff --git a/src/lib/corelib/language/tst_language.cpp b/src/lib/corelib/language/tst_language.cpp
index 973782ab5..28fa6b871 100644
--- a/src/lib/corelib/language/tst_language.cpp
+++ b/src/lib/corelib/language/tst_language.cpp
@@ -472,6 +472,8 @@ void TestLanguage::erroneousFiles_data()
<< "Property 'blubb' is not declared.";
QTest::newRow("undeclared_property_in_export_item2")
<< "Item 'something' is not declared.";
+ QTest::newRow("undeclared_property_in_export_item3")
+ << "Property 'blubb' is not declared.";
QTest::newRow("unknown_item_type")
<< "Unexpected item type 'Narf'";
QTest::newRow("invalid_child_item_type")
@@ -510,7 +512,6 @@ void TestLanguage::erroneousFiles()
}
return;
}
- QEXPECT_FAIL("undeclared_property_in_export_item2", "QBS-851", Continue);
QEXPECT_FAIL("misused-inherited-property", "QBS-847", Continue);
QVERIFY(!"No error thrown on invalid input.");
}