aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsimporter.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-01-24 14:08:50 +0100
committerUlf Hermann <ulf.hermann@qt.io>2023-01-30 15:58:12 +0100
commit07185214ddc593f460b053acd89bbd96b62a2ba5 (patch)
tree570d1f39b6d0511f3ecb204fb2a9db2fa5e8e013 /src/qmlcompiler/qqmljsimporter.cpp
parent9e4f6d92111bff0d422609704673cc0d9a46cafd (diff)
QmlCompiler: Fix version resolution for imports
Partially versioned imports should not be sorted useing the generic comparison operators. We have to check each component individually. Pick-to: 6.5 Fixes: QTBUG-110320 Change-Id: Id75ab73ff6a4b5b040b9fcbb426e6bcf893d3d8b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsimporter.cpp')
-rw-r--r--src/qmlcompiler/qqmljsimporter.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/qmlcompiler/qqmljsimporter.cpp b/src/qmlcompiler/qqmljsimporter.cpp
index 5f00e3a578..2b42941039 100644
--- a/src/qmlcompiler/qqmljsimporter.cpp
+++ b/src/qmlcompiler/qqmljsimporter.cpp
@@ -310,8 +310,14 @@ void QQmlJSImporter::importDependencies(const QQmlJSImporter::Import &import,
static bool isVersionAllowed(const QQmlJSScope::Export &exportEntry,
const QQmlJSScope::Import &importDescription)
{
- return !importDescription.version().isValid()
- || exportEntry.version() <= importDescription.version();
+ const QTypeRevision importVersion = importDescription.version();
+ const QTypeRevision exportVersion = exportEntry.version();
+ if (!importVersion.hasMajorVersion())
+ return true;
+ if (importVersion.majorVersion() != exportVersion.majorVersion())
+ return false;
+ return !importVersion.hasMinorVersion()
+ || exportVersion.minorVersion() <= importVersion.minorVersion();
}
void QQmlJSImporter::processImport(const QQmlJSScope::Import &importDescription,