QmlJS: Do not set import as invalid if sub import fails

QtQuick.Controls has sub imports like QtQuick.Controls.macOS/windows
that wil lbe invalid on other platforms. In this case we do not want
to mark the original import as invalid, since it turns
off checks in QmlJSCheck.

Therefore moving the setting to invalid into the block that is only
executed for non optional sub imports.

Task-number: QDS-9094
Change-Id: If0ad4e32c14d608f88b8239f390208e51a93fbd8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Thomas Hartmann
2023-02-09 23:12:41 +01:00
parent 1a30062c8a
commit 5e70a0e374

View File

@@ -521,8 +521,8 @@ bool LinkPrivate::importLibrary(const Document::Ptr &doc,
bool subImportFound = importLibrary(doc, subImport.libraryPath, &subImport, targetObject, importPath, true);
if (!subImportFound && errorLoc.isValid()) {
import->valid = false;
if (!(optional || (toImport.flags & QmlDirParser::Import::Optional))) {
import->valid = false;
error(doc,
errorLoc,
Link::tr("Implicit import '%1' of QML module '%2' not found.\n\n"