QtQml: Record import versions in AOT lookup signatures
A document can import the same module several times, with different
versions and qualifiers. Different versions of a module can provide
different types under the same name. The lookup signatures only
recorded the module and the type name, though. The validator resolved
the type through whichever import of the module it found first. If that
was an import of a different version than the one the compiler had seen,
we validated the lookup against the wrong type and rejected a valid
compilation unit.
Record the version of the import through which the type is found, and
only resolve the type through an import of exactly that module and
version. Also record the name the import provides the type under, rather
than the base name of the file. The two don't have to match.
This changes the layout of the lookup signatures. Bump the data
structure version.
Pick-to: 6.12
Task-number: QTBUG-150967
Change-Id: Ie0b9efa4188e9b2e03c7f0cc128fff87912430d3
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
| commit | eba44d1ea856c4db1ef3970f78a19d015ff16434 |
| parent | 8de3799d59277300909fef78d3bb020c2cd58d88 |
| author | Ulf Hermann <ulf.hermann@qt.io> |
| committer | Ulf Hermann <ulf.hermann@qt.io> |
| commit time | Mon, 12 Oct 2026 12:28:17 +0000 |
- M src/qml/common/qv4compileddata_p.h
- M src/qml/qml/qqml.cpp
- M src/qml/qml/qqmlimport.cpp
- M src/qml/qml/qqmlimport_p.h
- M src/qml/qml/qqmlprivate.h
- M src/qml/qml/qqmltypenamecache_p.h
- M src/qmlcompiler/qqmljscompiler.cpp
- M src/qmlcompiler/qqmljslookupsignatures.cpp
- M src/qmlpreview/qqmlpreviewdiff.cpp
- M tests/auto/qml/qmlnoresourcetargetpath/CMakeLists.txt
- A tests/auto/qml/qmlnoresourcetargetpath/NtpMixedVersions.qml
- A tests/auto/qml/qmlnoresourcetargetpath/NtpQualifiedOnly.qml
- A tests/auto/qml/qmlnoresourcetargetpath/NtpShifting1.qml
- A tests/auto/qml/qmlnoresourcetargetpath/NtpShifting2.qml
- A tests/auto/qml/qmlnoresourcetargetpath/NtpVersioned/CMakeLists.txt
- A tests/auto/qml/qmlnoresourcetargetpath/NtpVersioned/Early.qml
- A tests/auto/qml/qmlnoresourcetargetpath/NtpVersioned/Late.qml
- A tests/auto/qml/qmlnoresourcetargetpath/NtpVersioned/v1/Shifting.qml
- A tests/auto/qml/qmlnoresourcetargetpath/NtpVersioned/v2/Shifting.qml
- M tests/auto/qml/qmlnoresourcetargetpath/tst_qmlnoresourcetargetpath.cpp