QmlDesigner: Improve exported type name table

Previously, the table used SQLite's default rowid, which introduces an
additional lookup overhead during queries. By switching to a WITHOUT
ROWID table structure, SQLite can optimize lookups more efficiently,
especially when using primary keys. (See: SQLite WITHOUT ROWID)

Since primary keys in SQLite cannot contain NULL values, we now encode
the major and minor version information using the maximum integer value
to represent the absence of a version. This ensures that version-less
types are always preferred in comparisons and sorting, aligning with our
intended behavior.

Change-Id: I8f851d17a8c7d38c6d0928ee84a6cc7b4953e7e9
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2025-06-16 18:03:32 +02:00
parent e7cf02adbe
commit 097a72c7da
10 changed files with 383 additions and 341 deletions

View File

@@ -649,6 +649,11 @@ private:
operator long() const { return statement.fetchLongValue(column); }
operator unsigned int() const
{
return static_cast<unsigned int>(statement.fetchLongLongValue(column));
}
operator long long() const { return statement.fetchLongLongValue(column); }
operator double() const { return statement.fetchDoubleValue(column); }

View File

@@ -387,8 +387,8 @@ ImportedTypeNameId ModelPrivate::importedTypeNameId(Utils::SmallStringView typeN
: ModuleKind::PathLibrary;
ModuleId moduleId = projectStorage->moduleId(Utils::PathString{found->url()},
moduleKind);
ImportId importId = projectStorage->importId(
Storage::Import{moduleId, found->majorVersion(), found->minorVersion(), m_sourceId});
ImportId importId = projectStorage->importId(Storage::Import::fromSignedInteger(
moduleId, found->majorVersion(), found->minorVersion(), m_sourceId));
return projectStorage->importedTypeNameId(importId, shortTypeName);
}
}

View File

@@ -130,7 +130,7 @@ struct ProjectStorage::Statements
"WHERE t.typeId=?",
database};
mutable Sqlite::ReadStatement<5, 1> selectExportedTypesByTypeIdStatement{
"SELECT moduleId, typeId, name, ifnull(majorVersion, -1), ifnull(minorVersion, -1) "
"SELECT moduleId, typeId, name, majorVersion, minorVersion "
"FROM exportedTypeNames "
"WHERE typeId=?",
database};
@@ -138,8 +138,8 @@ struct ProjectStorage::Statements
"SELECT etn.moduleId, "
" typeId, "
" name, "
" ifnull(etn.majorVersion, -1), "
" ifnull(etn.minorVersion, -1) "
" etn.majorVersion, "
" etn.minorVersion "
"FROM exportedTypeNames AS etn "
"JOIN documentImports USING(moduleId) "
"WHERE typeId=?1 AND sourceId=?2",
@@ -186,7 +186,7 @@ struct ProjectStorage::Statements
"SELECT DISTINCT typeId FROM types WHERE (sourceId IN carray(?1) AND typeId NOT IN "
"carray(?2))",
database};
Sqlite::WriteStatement<1> deleteTypeNamesByTypeIdStatement{
Sqlite::WriteStatement<1> deleteExportedTypeNamesByTypeIdStatement{
"DELETE FROM exportedTypeNames WHERE typeId=?", database};
Sqlite::WriteStatement<1> deleteEnumerationDeclarationByTypeIdStatement{
"DELETE FROM enumerationDeclarations WHERE typeId=?", database};
@@ -630,13 +630,16 @@ struct ProjectStorage::Statements
"RETURNING importedTypeNameId",
database};
mutable Sqlite::ReadStatement<1, 2> selectImportIdBySourceIdAndModuleIdStatement{
"SELECT importId FROM documentImports WHERE sourceId=?1 AND moduleId=?2 AND "
"majorVersion "
"IS NULL AND minorVersion IS NULL LIMIT 1",
"SELECT importId "
"FROM documentImports "
"WHERE sourceId=?1 AND moduleId=?2 AND majorVersion=0xFFFFFFFF AND minorVersion=0xFFFFFFFF "
"LIMIT 1",
database};
mutable Sqlite::ReadStatement<1, 3> selectImportIdBySourceIdAndModuleIdAndMajorVersionStatement{
"SELECT importId FROM documentImports WHERE sourceId=?1 AND moduleId=?2 AND "
"majorVersion=?3 AND minorVersion IS NULL LIMIT 1",
"SELECT importId "
"FROM documentImports "
"WHERE sourceId=?1 AND moduleId=?2 AND majorVersion=?3 AND minorVersion=0xFFFFFFFF "
"LIMIT 1",
database};
mutable Sqlite::ReadStatement<1, 4> selectImportIdBySourceIdAndModuleIdAndVersionStatement{
"SELECT importId FROM documentImports WHERE sourceId=?1 AND moduleId=?2 AND "
@@ -647,53 +650,57 @@ struct ProjectStorage::Statements
mutable Sqlite::ReadStatement<1, 1> selectNameFromImportedTypeNamesStatement{
"SELECT name FROM importedTypeNames WHERE importedTypeNameId=?1", database};
mutable Sqlite::ReadStatement<1, 1> selectTypeIdForQualifiedImportedTypeNameNamesStatement{
"SELECT typeId FROM importedTypeNames AS itn JOIN documentImports AS di ON "
"importOrSourceId=di.importId JOIN documentImports AS di2 ON di.sourceId=di2.sourceId "
"AND "
"di.moduleId=di2.sourceModuleId "
"JOIN exportedTypeNames AS etn ON di2.moduleId=etn.moduleId WHERE "
"itn.kind=2 AND importedTypeNameId=?1 AND itn.name=etn.name AND "
"(di.majorVersion IS NULL OR (di.majorVersion=etn.majorVersion AND (di.minorVersion IS "
"NULL OR di.minorVersion>=etn.minorVersion))) ORDER BY etn.majorVersion DESC NULLS "
"FIRST, "
"etn.minorVersion DESC NULLS FIRST LIMIT 1",
database};
mutable Sqlite::ReadStatement<1, 1> selectTypeIdForImportedTypeNameNamesStatement{
"WITH "
" importTypeNames(moduleId, name, kind, majorVersion, minorVersion) AS ( "
" SELECT moduleId, name, di.kind, majorVersion, minorVersion "
" FROM importedTypeNames AS itn JOIN documentImports AS di ON "
" importOrSourceId=sourceId "
" WHERE "
" importedTypeNameId=?1 AND itn.kind=1) "
"SELECT typeId FROM importTypeNames AS itn "
" JOIN exportedTypeNames AS etn USING(moduleId, name) "
"WHERE (itn.majorVersion IS NULL OR (itn.majorVersion=etn.majorVersion "
" AND (itn.minorVersion IS NULL OR itn.minorVersion>=etn.minorVersion))) "
"ORDER BY itn.kind, etn.majorVersion DESC NULLS FIRST, etn.minorVersion DESC NULLS "
"FIRST "
"SELECT typeId "
"FROM importedTypeNames AS itn "
" JOIN documentImports AS di ON importOrSourceId=di.importId "
" JOIN documentImports AS di2 ON di.sourceId=di2.sourceId "
" AND di.moduleId=di2.sourceModuleId "
" JOIN exportedTypeNames AS etn ON di2.moduleId=etn.moduleId "
"WHERE itn.kind=2 "
" AND importedTypeNameId=?1 "
" AND itn.name=etn.name "
" AND (di.majorVersion=0xFFFFFFFF "
" OR (di.majorVersion=etn.majorVersion "
" AND (di.minorVersion=0xFFFFFFFF OR di.minorVersion>=etn.minorVersion))) "
"ORDER BY etn.majorVersion DESC, etn.minorVersion DESC "
"LIMIT 1",
database};
mutable Sqlite::ReadStatement<6, 1> selectExportedTypesForSourceIdsStatement{
"SELECT moduleId, name, ifnull(majorVersion, -1), ifnull(minorVersion, -1), typeId, "
"exportedTypeNameId FROM exportedTypeNames WHERE typeId in carray(?1) ORDER BY "
"moduleId, "
"name, majorVersion, minorVersion",
mutable Sqlite::ReadStatement<1, 1> selectTypeIdForImportedTypeNameNamesStatement{
"SELECT typeId FROM importedTypeNames AS itn "
" JOIN exportedTypeNames AS etn USING(name) "
" JOIN documentImports AS di ON importOrSourceId=sourceId "
"WHERE importedTypeNameId=?1 "
" AND itn.kind=1 "
" AND etn.moduleId=di.moduleId "
" AND (di.majorVersion=0xFFFFFFFF "
" OR (di.majorVersion=etn.majorVersion "
" AND (di.minorVersion=0xFFFFFFFF OR di.minorVersion>=etn.minorVersion))) "
"ORDER BY di.kind, etn.majorVersion DESC, etn.minorVersion DESC "
"LIMIT 1",
database};
Sqlite::WriteStatement<5> insertExportedTypeNamesWithVersionStatement{
mutable Sqlite::ReadStatement<5, 1> selectExportedTypesForSourceIdsStatement{
"SELECT moduleId, "
" name, "
" majorVersion, "
" minorVersion, "
" typeId "
"FROM exportedTypeNames "
"WHERE typeId in carray(?1) "
"ORDER BY name, moduleId, majorVersion, minorVersion",
database};
Sqlite::WriteStatement<5> insertExportedTypeNamesStatement{
"INSERT INTO exportedTypeNames(moduleId, name, majorVersion, minorVersion, typeId) "
"VALUES(?1, ?2, ?3, ?4, ?5)",
database};
Sqlite::WriteStatement<4> insertExportedTypeNamesWithMajorVersionStatement{
"INSERT INTO exportedTypeNames(moduleId, name, majorVersion, typeId) "
"VALUES(?1, ?2, ?3, ?4)",
Sqlite::WriteStatement<4> deleteExportedTypeNameStatement{
"DELETE FROM exportedTypeNames "
"WHERE name=?2 AND moduleId=?1 AND majorVersion=?3 AND minorVersion=?4",
database};
Sqlite::WriteStatement<5> updateExportedTypeNameTypeIdStatement{
"UPDATE exportedTypeNames "
"SET typeId=?5 "
"WHERE name=?2 AND moduleId=?1 AND majorVersion=?3 AND minorVersion=?4",
database};
Sqlite::WriteStatement<3> insertExportedTypeNamesWithoutVersionStatement{
"INSERT INTO exportedTypeNames(moduleId, name, typeId) VALUES(?1, ?2, ?3)", database};
Sqlite::WriteStatement<1> deleteExportedTypeNameStatement{
"DELETE FROM exportedTypeNames WHERE exportedTypeNameId=?", database};
Sqlite::WriteStatement<2> updateExportedTypeNameTypeIdStatement{
"UPDATE exportedTypeNames SET typeId=?2 WHERE exportedTypeNameId=?1", database};
mutable Sqlite::ReadStatement<4, 1> selectDirectoryInfosForDirectoryIdsStatement{
"SELECT directoryId, sourceId, moduleId, fileType FROM directoryInfos WHERE "
"directoryId IN carray(?1) ORDER BY directoryId, sourceId",
@@ -725,17 +732,15 @@ struct ProjectStorage::Statements
mutable Sqlite::ReadStatement<1, 1> selectTypeIdsForSourceIdsStatement{
"SELECT typeId FROM types WHERE sourceId IN carray(?1)", database};
mutable Sqlite::ReadStatement<6, 1> selectModuleExportedImportsForSourceIdStatement{
"SELECT moduleExportedImportId, moduleId, exportedModuleId, ifnull(majorVersion, -1), "
"ifnull(minorVersion, -1), isAutoVersion FROM moduleExportedImports WHERE moduleId IN "
"carray(?1) ORDER BY moduleId, exportedModuleId",
database};
Sqlite::WriteStatement<3> insertModuleExportedImportWithoutVersionStatement{
"INSERT INTO moduleExportedImports(moduleId, exportedModuleId, isAutoVersion) "
"VALUES (?1, ?2, ?3)",
database};
Sqlite::WriteStatement<4> insertModuleExportedImportWithMajorVersionStatement{
"INSERT INTO moduleExportedImports(moduleId, exportedModuleId, isAutoVersion, "
"majorVersion) VALUES (?1, ?2, ?3, ?4)",
"SELECT moduleExportedImportId, "
" moduleId, "
" exportedModuleId, "
" majorVersion, "
" minorVersion, "
" isAutoVersion "
"FROM moduleExportedImports "
"WHERE moduleId IN carray(?1) "
"ORDER BY moduleId, exportedModuleId",
database};
Sqlite::WriteStatement<5> insertModuleExportedImportWithVersionStatement{
"INSERT INTO moduleExportedImports(moduleId, exportedModuleId, isAutoVersion, "
@@ -757,7 +762,7 @@ struct ProjectStorage::Statements
" iif(mei.isAutoVersion=1, i.minorVersion, mei.minorVersion), "
" mei.moduleExportedImportId "
" FROM moduleExportedImports AS mei JOIN imports AS i USING(moduleId)) "
"SELECT DISTINCT moduleId, ifnull(majorVersion, -1), ifnull(minorVersion, -1) "
"SELECT DISTINCT moduleId, majorVersion, minorVersion "
"FROM imports",
database};
mutable Sqlite::ReadStatement<1, 1> selectLocalPropertyDeclarationIdsForTypeStatement{
@@ -1072,28 +1077,21 @@ public:
{
Sqlite::StrictTable table;
table.setUseIfNotExists(true);
table.setUseWithoutRowId(true);
table.setName("exportedTypeNames");
table.addColumn("exportedTypeNameId",
Sqlite::StrictColumnType::Integer,
{Sqlite::PrimaryKey{}});
auto &nameColumn = table.addColumn("name", Sqlite::StrictColumnType::Text);
auto &moduleIdColumn = table.addForeignKeyColumn("moduleId",
foreignModuleIdColumn,
Sqlite::ForeignKeyAction::NoAction,
Sqlite::ForeignKeyAction::NoAction);
auto &nameColumn = table.addColumn("name", Sqlite::StrictColumnType::Text);
auto &typeIdColumn = table.addColumn("typeId", Sqlite::StrictColumnType::Integer);
auto &majorVersionColumn = table.addColumn("majorVersion", Sqlite::StrictColumnType::Integer);
auto &minorVersionColumn = table.addColumn("minorVersion", Sqlite::StrictColumnType::Integer);
table.addUniqueIndex({nameColumn, moduleIdColumn},
"majorVersion IS NULL AND minorVersion IS NULL");
table.addUniqueIndex({nameColumn, moduleIdColumn, majorVersionColumn},
"majorVersion IS NOT NULL AND minorVersion IS NULL");
table.addUniqueIndex({nameColumn, moduleIdColumn, majorVersionColumn, minorVersionColumn},
"majorVersion IS NOT NULL AND minorVersion IS NOT NULL");
table.addPrimaryKeyContraint(
{nameColumn, moduleIdColumn, majorVersionColumn, minorVersionColumn});
table.addIndex({typeIdColumn});
table.addIndex({nameColumn, moduleIdColumn});
table.addIndex({moduleIdColumn});
table.initialize(database);
@@ -1236,24 +1234,13 @@ public:
auto &parentImportIdColumn = table.addColumn("parentImportId",
Sqlite::StrictColumnType::Integer);
table.addUniqueIndex(
{sourceIdColumn, moduleIdColumn, kindColumn, sourceModuleIdColumn, parentImportIdColumn},
"majorVersion IS NULL AND minorVersion IS NULL");
table.addUniqueIndex({sourceIdColumn,
moduleIdColumn,
kindColumn,
sourceModuleIdColumn,
majorVersionColumn,
parentImportIdColumn},
"majorVersion IS NOT NULL AND minorVersion IS NULL");
table.addUniqueIndex({sourceIdColumn,
moduleIdColumn,
kindColumn,
sourceModuleIdColumn,
majorVersionColumn,
minorVersionColumn,
parentImportIdColumn},
"majorVersion IS NOT NULL AND minorVersion IS NOT NULL");
parentImportIdColumn});
table.addIndex({sourceIdColumn, kindColumn});
@@ -2891,22 +2878,11 @@ void ProjectStorage::synchromizeModuleExportedImports(
keyValue("module id", import.moduleId)};
tracer.tick("exported module", keyValue("module id", import.exportedModuleId));
if (import.version.minor) {
s->insertModuleExportedImportWithVersionStatement.write(import.moduleId,
import.exportedModuleId,
import.isAutoVersion,
import.version.major.value,
import.version.minor.value);
} else if (import.version.major) {
s->insertModuleExportedImportWithMajorVersionStatement.write(import.moduleId,
import.exportedModuleId,
import.isAutoVersion,
import.version.major.value);
} else {
s->insertModuleExportedImportWithoutVersionStatement.write(import.moduleId,
import.exportedModuleId,
import.isAutoVersion);
}
};
auto update = [](const Storage::Synchronization::ModuleExportedImportView &,
@@ -3125,7 +3101,7 @@ void ProjectStorage::deleteType(TypeId typeId,
handlePropertyDeclarationWithPropertyType(typeId, relinkablePropertyDeclarations);
handleAliasPropertyDeclarationsWithPropertyType(typeId, relinkableAliasPropertyDeclarations);
handleBases(typeId, relinkableBases);
s->deleteTypeNamesByTypeIdStatement.write(typeId);
s->deleteExportedTypeNamesByTypeIdStatement.write(typeId);
s->deleteEnumerationDeclarationByTypeIdStatement.write(typeId);
s->deletePropertyDeclarationByTypeIdStatement.write(typeId);
s->deleteFunctionDeclarationByTypeIdStatement.write(typeId);
@@ -3418,19 +3394,8 @@ void ProjectStorage::synchronizeExportedTypes(
addedExportedTypeNames.reserve(exportedTypes.size());
std::ranges::sort(exportedTypes, [](auto &&first, auto &&second) {
if (first.moduleId < second.moduleId)
return true;
else if (first.moduleId > second.moduleId)
return false;
auto nameCompare = Sqlite::compare(first.name, second.name);
if (nameCompare < 0)
return true;
else if (nameCompare > 0)
return false;
return first.version < second.version;
return std::tie(first.name, first.moduleId, first.version.major, first.version.minor)
< std::tie(second.name, second.moduleId, second.version.major, second.version.minor);
});
auto range = s->selectExportedTypesForSourceIdsStatement
@@ -3439,8 +3404,8 @@ void ProjectStorage::synchronizeExportedTypes(
auto compareKey = [](const Storage::Synchronization::ExportedTypeView &view,
const Storage::Synchronization::ExportedType &type) {
return std::tie(view.moduleId, view.name, view.version.major.value, view.version.minor.value)
<=> std::tie(type.moduleId, type.name, type.version.major.value, type.version.minor.value);
return std::tie(view.name, view.moduleId, view.version.major.value, view.version.minor.value)
<=> std::tie(type.name, type.moduleId, type.version.major.value, type.version.minor.value);
};
auto insert = [&](const Storage::Synchronization::ExportedType &type) {
@@ -3453,23 +3418,12 @@ void ProjectStorage::synchronizeExportedTypes(
throw QmlDesigner::ModuleDoesNotExists{};
try {
if (type.version) {
s->insertExportedTypeNamesWithVersionStatement.write(type.moduleId,
s->insertExportedTypeNamesStatement.write(type.moduleId,
type.name,
type.version.major.value,
type.version.minor.value,
type.typeId);
} else if (type.version.major) {
s->insertExportedTypeNamesWithMajorVersionStatement.write(type.moduleId,
type.name,
type.version.major.value,
type.typeId);
} else {
s->insertExportedTypeNamesWithoutVersionStatement.write(type.moduleId,
type.name,
type.typeId);
}
} catch (const Sqlite::ConstraintPreventsModification &) {
throw QmlDesigner::ExportedTypeCannotBeInserted{type.name};
}
@@ -3501,7 +3455,11 @@ void ProjectStorage::synchronizeExportedTypes(
handleAliasPropertyDeclarationsWithPropertyType(view.typeId,
relinkableAliasPropertyDeclarations);
handleBases(view.typeId, relinkableBases);
s->updateExportedTypeNameTypeIdStatement.write(view.exportedTypeNameId, type.typeId);
s->updateExportedTypeNameTypeIdStatement.write(view.moduleId,
view.name,
view.version.major.value,
view.version.minor.value,
type.typeId);
exportedTypesChanged = ExportedTypesChanged::Yes;
addedExportedTypeNames.emplace_back(type.moduleId, type.typeId, type.name, type.version);
@@ -3524,7 +3482,10 @@ void ProjectStorage::synchronizeExportedTypes(
relinkableAliasPropertyDeclarations);
handleBases(view.typeId, relinkableBases);
s->deleteExportedTypeNameStatement.write(view.exportedTypeNameId);
s->deleteExportedTypeNameStatement.write(view.moduleId,
view.name,
view.version.major.value,
view.version.minor.value);
removedExportedTypeNames.emplace_back(view.moduleId, view.typeId, view.name, view.version);
@@ -3901,7 +3862,6 @@ ImportId ProjectStorage::insertDocumentImport(const Storage::Import &import,
handleBasesWithSourceId(import.sourceId, relinkableBases);
}
if (import.version.minor) {
return s->insertDocumentImportWithVersionStatement.value<ImportId>(import.sourceId,
import.moduleId,
sourceModuleId,
@@ -3909,20 +3869,6 @@ ImportId ProjectStorage::insertDocumentImport(const Storage::Import &import,
import.version.major.value,
import.version.minor.value,
parentImportId);
} else if (import.version.major) {
return s->insertDocumentImportWithMajorVersionStatement.value<ImportId>(import.sourceId,
import.moduleId,
sourceModuleId,
importKind,
import.version.major.value,
parentImportId);
} else {
return s->insertDocumentImportWithoutVersionStatement.value<ImportId>(import.sourceId,
import.moduleId,
sourceModuleId,
importKind,
parentImportId);
}
}
void ProjectStorage::synchronizeDocumentImports(Storage::Imports &imports,
@@ -3959,7 +3905,9 @@ void ProjectStorage::synchronizeDocumentImports(Storage::Imports &imports,
auto importId = insertDocumentImport(
import, importKind, import.moduleId, ImportId{}, relink, relinkableBases);
auto callback = [&](ModuleId exportedModuleId, int majorVersion, int minorVersion) {
auto callback = [&](ModuleId exportedModuleId,
unsigned int majorVersion,
unsigned int minorVersion) {
Storage::Import additionImport{exportedModuleId,
Storage::Version{majorVersion, minorVersion},
import.sourceId};

View File

@@ -250,40 +250,60 @@ using TypeNameString = ::Utils::BasicSmallString<64>;
class VersionNumber
{
public:
explicit VersionNumber() = default;
explicit VersionNumber(int value)
constexpr VersionNumber() = default;
explicit constexpr VersionNumber(unsigned int value)
: value{value}
{}
explicit operator bool() const { return value >= 0; }
explicit constexpr operator bool() const
{
return value != std::numeric_limits<unsigned int>::max();
}
auto operator<=>(const VersionNumber &first) const noexcept = default;
constexpr auto operator<=>(const VersionNumber &first) const noexcept = default;
static constexpr VersionNumber noVersionNumber() { return VersionNumber{noVersion}; }
static constexpr VersionNumber convertFromSignedInteger(int number)
{
return VersionNumber{number < 0 ? noVersion : static_cast<unsigned int>(number)};
}
inline static constexpr unsigned int noVersion = std::numeric_limits<unsigned int>::max();
public:
int value = -1;
unsigned int value = noVersion;
};
class Version
{
public:
explicit Version() = default;
explicit Version(VersionNumber major, VersionNumber minor = VersionNumber{})
constexpr Version() = default;
explicit constexpr Version(VersionNumber major, VersionNumber minor = VersionNumber{})
: major{major}
, minor{minor}
{}
explicit Version(int major, int minor)
constexpr Version(unsigned int major, unsigned int minor)
: major{major}
, minor{minor}
{}
explicit Version(int major)
explicit constexpr Version(unsigned int major)
: major{major}
{}
auto operator<=>(const Version &first) const noexcept = default;
constexpr auto operator<=>(const Version &first) const noexcept = default;
explicit operator bool() const { return major && minor; }
explicit constexpr operator bool() const { return major && minor; }
static constexpr Version convertFromSignedInteger(int majorVersion, int minorVersion)
{
return Version{VersionNumber::convertFromSignedInteger(majorVersion),
VersionNumber::convertFromSignedInteger(minorVersion)};
}
template<typename String>
friend void convertToString(String &string, const Version &version)
@@ -465,8 +485,8 @@ public:
ExportedTypeName(ModuleId moduleId,
TypeId typeId,
::Utils::SmallStringView name,
int majorVersion,
int minorVersion)
unsigned int majorVersion,
unsigned int minorVersion)
: name{name}
, version{majorVersion, minorVersion}
, moduleId{moduleId}

View File

@@ -21,20 +21,25 @@ namespace QmlDesigner::Storage {
class Import
{
public:
explicit Import() = default;
Import() = default;
explicit Import(ModuleId moduleId, Storage::Version version, SourceId sourceId)
Import(ModuleId moduleId, Storage::Version version, SourceId sourceId)
: version{version}
, moduleId{moduleId}
, sourceId{sourceId}
{}
explicit Import(ModuleId moduleId, int majorVersion, int minorVersion, SourceId sourceId)
Import(ModuleId moduleId, unsigned int majorVersion, unsigned int minorVersion, SourceId sourceId)
: version{majorVersion, minorVersion}
, moduleId{moduleId}
, sourceId{sourceId}
{}
static Import fromSignedInteger(ModuleId moduleId, int majorVersion, int minorVersion, SourceId sourceId)
{
return {moduleId, Version::convertFromSignedInteger(majorVersion, minorVersion), sourceId};
}
friend bool operator==(const Import &first, const Import &second)
{
return first.moduleId == second.moduleId && first.version == second.version
@@ -157,8 +162,11 @@ class ImportView
public:
explicit ImportView() = default;
explicit ImportView(
ImportId importId, SourceId sourceId, ModuleId moduleId, int majorVersion, int minorVersion)
explicit ImportView(ImportId importId,
SourceId sourceId,
ModuleId moduleId,
unsigned int majorVersion,
unsigned int minorVersion)
: importId{importId}
, sourceId{sourceId}
, moduleId{moduleId}
@@ -267,8 +275,8 @@ public:
explicit ModuleExportedImportView(ModuleExportedImportId moduleExportedImportId,
ModuleId moduleId,
ModuleId exportedModuleId,
int majorVersion,
int minorVersion,
unsigned int majorVersion,
unsigned int minorVersion,
IsAutoVersion isAutoVersion)
: moduleExportedImportId{moduleExportedImportId}
, version{majorVersion, minorVersion}
@@ -395,8 +403,8 @@ public:
explicit ExportedType(ModuleId moduleId,
TypeId typeId,
::Utils::SmallStringView name,
int majorVersion,
int minorVersion)
unsigned int majorVersion,
unsigned int minorVersion)
: name{name}
, version{majorVersion, minorVersion}
, typeId{typeId}
@@ -445,17 +453,16 @@ public:
, version{version}
, moduleId{moduleId}
{}
explicit ExportedTypeView(ModuleId moduleId,
::Utils::SmallStringView name,
int majorVersion,
int minorVersion,
TypeId typeId,
ExportedTypeNameId exportedTypeNameId)
unsigned int majorVersion,
unsigned int minorVersion,
TypeId typeId)
: name{name}
, version{majorVersion, minorVersion}
, typeId{typeId}
, moduleId{moduleId}
, exportedTypeNameId{exportedTypeNameId}
{}
template<typename String>
@@ -466,8 +473,7 @@ public:
auto dict = dictonary(keyValue("name", exportedType.name),
keyValue("module id", exportedType.moduleId),
keyValue("type id", exportedType.typeId),
keyValue("version", exportedType.version),
keyValue("version", exportedType.exportedTypeNameId));
keyValue("version", exportedType.version));
convertToString(string, dict);
}
@@ -477,7 +483,6 @@ public:
Storage::Version version;
TypeId typeId;
ModuleId moduleId;
ExportedTypeNameId exportedTypeNameId;
};
using ImportedTypeName = std::variant<ImportedType, QualifiedImportedType>;

View File

@@ -158,8 +158,15 @@ void addSourceIds(SourceIds &sourceIds,
Storage::Version convertVersion(QTypeRevision version)
{
return Storage::Version{version.hasMajorVersion() ? version.majorVersion() : -1,
version.hasMinorVersion() ? version.minorVersion() : -1};
using Storage::Version;
using Storage::VersionNumber;
return Version{version.hasMajorVersion()
? VersionNumber::convertFromSignedInteger(version.majorVersion())
: VersionNumber::noVersionNumber(),
version.hasMinorVersion()
? VersionNumber::convertFromSignedInteger(version.minorVersion())
: VersionNumber::noVersionNumber()};
}
Storage::Synchronization::IsAutoVersion convertToIsAutoVersion(QQmlDirParser::Import::Flags flags,
@@ -1431,7 +1438,8 @@ Storage::Synchronization::ExportedTypes createExportedTypes(ProjectStorageUpdate
for (const ProjectStorageUpdater::Component &component : components) {
exportedTypes.emplace_back(component.moduleId,
Utils::SmallString{component.typeName},
Storage::Version{component.majorVersion, component.minorVersion});
Storage::Version::convertFromSignedInteger(component.majorVersion,
component.minorVersion));
}
removeDuplicates(exportedTypes);

View File

@@ -37,15 +37,9 @@ namespace {
using QualifiedImports = std::map<QString, Storage::Import>;
int convertVersionNumber(qint32 versionNumber)
{
return versionNumber < 0 ? -1 : versionNumber;
}
Storage::Version convertVersion(QmlDom::Version version)
{
return Storage::Version{convertVersionNumber(version.majorVersion),
convertVersionNumber(version.minorVersion)};
return Storage::Version::convertFromSignedInteger(version.majorVersion, version.minorVersion);
}
Utils::PathString createNormalizedPath(Utils::SmallStringView directoryPath,

View File

@@ -21,6 +21,7 @@ using QmlDesigner::ModelNodes;
using QmlDesigner::Storage::ModuleKind;
using QmlDesigner::Storage::TypeTraits;
using QmlDesigner::Storage::TypeTraitsKind;
using QmlDesigner::Storage::VersionNumber;
template<typename Matcher>
auto PropertyId(const Matcher &matcher)
@@ -2487,21 +2488,27 @@ TEST_F(NodeMetaInfo, default_is_not_enumeration)
TEST_F(NodeMetaInfo, all_external_type_names)
{
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "Foo");
QmlDesigner::Storage::Info::ExportedTypeNames names{{qmlModuleId, metaInfo.id(), "Object", 2, -1},
QmlDesigner::Storage::Info::ExportedTypeNames names{
{qmlModuleId, metaInfo.id(), "Object", 2, VersionNumber::noVersion},
{qmlModuleId, metaInfo.id(), "Obj", 2, 1}};
ON_CALL(projectStorageMock, exportedTypeNames(metaInfo.id())).WillByDefault(Return(names));
auto exportedTypeNames = metaInfo.allExportedTypeNames();
ASSERT_THAT(exportedTypeNames,
UnorderedElementsAre(IsInfoExportTypeName(qmlModuleId, metaInfo.id(), "Object", 2, -1),
UnorderedElementsAre(IsInfoExportTypeName(qmlModuleId,
metaInfo.id(),
"Object",
2,
VersionNumber::noVersion),
IsInfoExportTypeName(qmlModuleId, metaInfo.id(), "Obj", 2, 1)));
}
TEST_F(NodeMetaInfo, default_has_no_external_type_names)
{
QmlDesigner::NodeMetaInfo metaInfo;
QmlDesigner::Storage::Info::ExportedTypeNames names{{qmlModuleId, metaInfo.id(), "Object", 2, -1},
QmlDesigner::Storage::Info::ExportedTypeNames names{
{qmlModuleId, metaInfo.id(), "Object", 2, VersionNumber::noVersion},
{qmlModuleId, metaInfo.id(), "Obj", 2, 1}};
ON_CALL(projectStorageMock, exportedTypeNames(_)).WillByDefault(Return(names));
@@ -2513,7 +2520,8 @@ TEST_F(NodeMetaInfo, default_has_no_external_type_names)
TEST_F(NodeMetaInfo, external_type_names_for_source_id)
{
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "Foo");
QmlDesigner::Storage::Info::ExportedTypeNames names{{qmlModuleId, metaInfo.id(), "Object", 2, -1},
QmlDesigner::Storage::Info::ExportedTypeNames names{
{qmlModuleId, metaInfo.id(), "Object", 2, VersionNumber::noVersion},
{qmlModuleId, metaInfo.id(), "Obj", 2, 1}};
ON_CALL(projectStorageMock, exportedTypeNames(metaInfo.id(), model.fileUrlSourceId()))
.WillByDefault(Return(names));
@@ -2521,14 +2529,19 @@ TEST_F(NodeMetaInfo, external_type_names_for_source_id)
auto exportedTypeNames = metaInfo.exportedTypeNamesForSourceId(model.fileUrlSourceId());
ASSERT_THAT(exportedTypeNames,
UnorderedElementsAre(IsInfoExportTypeName(qmlModuleId, metaInfo.id(), "Object", 2, -1),
UnorderedElementsAre(IsInfoExportTypeName(qmlModuleId,
metaInfo.id(),
"Object",
2,
VersionNumber::noVersion),
IsInfoExportTypeName(qmlModuleId, metaInfo.id(), "Obj", 2, 1)));
}
TEST_F(NodeMetaInfo, default_has_no_external_type_names_for_source_id)
{
QmlDesigner::NodeMetaInfo metaInfo;
QmlDesigner::Storage::Info::ExportedTypeNames names{{qmlModuleId, metaInfo.id(), "Object", 2, -1},
QmlDesigner::Storage::Info::ExportedTypeNames names{
{qmlModuleId, metaInfo.id(), "Object", 2, VersionNumber::noVersion},
{qmlModuleId, metaInfo.id(), "Obj", 2, 1}};
ON_CALL(projectStorageMock, exportedTypeNames(metaInfo.id(), model.fileUrlSourceId()))
.WillByDefault(Return(names));
@@ -2541,7 +2554,8 @@ TEST_F(NodeMetaInfo, default_has_no_external_type_names_for_source_id)
TEST_F(NodeMetaInfo, invalid_source_id_has_no_external_type_names_for_source_id)
{
auto metaInfo = createMetaInfo("QML", ModuleKind::QmlLibrary, "Foo");
QmlDesigner::Storage::Info::ExportedTypeNames names{{qmlModuleId, metaInfo.id(), "Object", 2, -1},
QmlDesigner::Storage::Info::ExportedTypeNames names{
{qmlModuleId, metaInfo.id(), "Object", 2, VersionNumber::noVersion},
{qmlModuleId, metaInfo.id(), "Obj", 2, 1}};
ON_CALL(projectStorageMock, exportedTypeNames(metaInfo.id(), model.fileUrlSourceId()))
.WillByDefault(Return(names));

View File

@@ -19,21 +19,22 @@
namespace {
using QmlDesigner::DirectoryPathId;
using QmlDesigner::DirectoryPathIds;
using QmlDesigner::FileNameId;
using QmlDesigner::FileStatus;
using QmlDesigner::FileStatuses;
using QmlDesigner::FlagIs;
using QmlDesigner::ModuleId;
using QmlDesigner::PropertyDeclarationId;
using QmlDesigner::DirectoryPathId;
using QmlDesigner::DirectoryPathIds;
using QmlDesigner::SourceId;
using QmlDesigner::SourceIds;
using QmlDesigner::FileNameId;
using QmlDesigner::Storage::ModuleKind;
using QmlDesigner::Storage::Synchronization::SynchronizationPackage;
using QmlDesigner::Storage::Synchronization::TypeAnnotations;
using QmlDesigner::Storage::TypeTraits;
using QmlDesigner::Storage::TypeTraitsKind;
using QmlDesigner::Storage::VersionNumber;
using QmlDesigner::TypeId;
namespace Storage = QmlDesigner::Storage;
@@ -5772,7 +5773,7 @@ TEST_F(ProjectStorage, minimal_updates)
TypeTraitsKind::Reference),
Field("Type::exportedTypes",
&Storage::Synchronization::Type::exportedTypes,
UnorderedElementsAre(IsExportedType(qtQuickModuleId, "Item", 2, 0),
UnorderedElementsAre(IsExportedType(qtQuickModuleId, "Item", 2U, 0U),
IsExportedType(qtQuickNativeModuleId,
"QQuickItem"))),
Field("Type::propertyDeclarations",
@@ -8224,9 +8225,14 @@ TEST_F(ProjectStorage, get_exported_type_names)
auto exportedTypeNames = storage.exportedTypeNames(typeId);
ASSERT_THAT(exportedTypeNames,
UnorderedElementsAre(IsInfoExportTypeName(qmlModuleId, typeId, "Object", 2, -1),
IsInfoExportTypeName(qmlModuleId, typeId, "Obj", 2, -1),
IsInfoExportTypeName(qmlNativeModuleId, typeId, "QObject", -1, -1)));
UnorderedElementsAre(
IsInfoExportTypeName(qmlModuleId, typeId, "Object", 2U, VersionNumber::noVersion),
IsInfoExportTypeName(qmlModuleId, typeId, "Obj", 2U, VersionNumber::noVersion),
IsInfoExportTypeName(qmlNativeModuleId,
typeId,
"QObject",
VersionNumber::noVersion,
VersionNumber::noVersion)));
}
TEST_F(ProjectStorage, get_no_exported_type_names_if_type_id_is_invalid)
@@ -8250,8 +8256,9 @@ TEST_F(ProjectStorage, get_exported_type_names_for_source_id)
auto exportedTypeNames = storage.exportedTypeNames(typeId, sourceId3);
ASSERT_THAT(exportedTypeNames,
UnorderedElementsAre(IsInfoExportTypeName(qmlModuleId, typeId, "Object", 2, -1),
IsInfoExportTypeName(qmlModuleId, typeId, "Obj", 2, -1)));
UnorderedElementsAre(
IsInfoExportTypeName(qmlModuleId, typeId, "Object", 2U, VersionNumber::noVersion),
IsInfoExportTypeName(qmlModuleId, typeId, "Obj", 2U, VersionNumber::noVersion)));
}
TEST_F(ProjectStorage, get_no_exported_type_names_for_source_id_for_invalid_type_id)

View File

@@ -89,6 +89,7 @@ using Storage::Synchronization::Type;
using Storage::TypeTraits;
using Storage::TypeTraitsKind;
using Storage::Version;
using Storage::VersionNumber;
using FileState = QmlDesigner::ProjectStorageUpdater::FileState;
using Update = QmlDesigner::ProjectStorageUpdater::Update;
using IsInsideProject = QmlDesigner::QmlDocumentParserInterface::IsInsideProject;
@@ -1806,8 +1807,7 @@ TEST_P(synchronize_changed_qml_documents, types)
EXPECT_CALL(
projectStorageMock,
synchronize(AllOf(
Field(
&SynchronizationPackage::types,
Field(&SynchronizationPackage::types,
UnorderedElementsAre(
AllOf(IsStorageType("First.qml",
ImportedType{"Object"},
@@ -1816,8 +1816,11 @@ TEST_P(synchronize_changed_qml_documents, types)
ChangeLevel::Full),
Field("Type::exportedTypes",
&Type::exportedTypes,
UnorderedElementsAre(IsExportedType(exampleModuleId, "FirstType", 1, 0),
IsExportedType(pathModuleId, "First", -1, -1)))),
UnorderedElementsAre(IsExportedType(exampleModuleId, "FirstType", 1U, 0U),
IsExportedType(pathModuleId,
"First",
VersionNumber::noVersion,
VersionNumber::noVersion)))),
AllOf(IsStorageType("First2.qml",
ImportedType{"Object2"},
TypeTraitsKind::Reference,
@@ -1825,8 +1828,11 @@ TEST_P(synchronize_changed_qml_documents, types)
ChangeLevel::Full),
Field("Type::exportedTypes",
&Type::exportedTypes,
UnorderedElementsAre(IsExportedType(exampleModuleId, "FirstType", 2, 2),
IsExportedType(pathModuleId, "First2", -1, -1)))),
UnorderedElementsAre(IsExportedType(exampleModuleId, "FirstType", 2U, 2U),
IsExportedType(pathModuleId,
"First2",
VersionNumber::noVersion,
VersionNumber::noVersion)))),
AllOf(IsStorageType("Second.qml",
ImportedType{"Object3"},
TypeTraitsKind::Reference,
@@ -1834,8 +1840,11 @@ TEST_P(synchronize_changed_qml_documents, types)
ChangeLevel::Full),
Field("Type::exportedTypes",
&Type::exportedTypes,
UnorderedElementsAre(IsExportedType(exampleModuleId, "SecondType", 2, 2),
IsExportedType(pathModuleId, "Second", -1, -1)))))),
UnorderedElementsAre(IsExportedType(exampleModuleId, "SecondType", 2U, 2U),
IsExportedType(pathModuleId,
"Second",
VersionNumber::noVersion,
VersionNumber::noVersion)))))),
Field("SynchronizationPackage::updatedSourceIds",
&SynchronizationPackage::updatedSourceIds,
IsSupersetOf({qmlDocument1SourceId, qmlDocument1_2SourceId, qmlDocument2SourceId})))));
@@ -2091,12 +2100,13 @@ TEST_P(synchronize_changed_qml_documents, types_in_qmldir_only)
}
setQmlFileNames(u"/path", {"First.qml"});
EXPECT_CALL(projectStorageMock,
EXPECT_CALL(
projectStorageMock,
synchronize(
AllOf(Field("SynchronizationPackage::types",
&SynchronizationPackage::types,
AllOf(Contains(AllOf(
IsStorageType("First.qml",
AllOf(Contains(
AllOf(IsStorageType("First.qml",
ImportedType{},
TypeTraitsKind::None,
qmlDocument1SourceId,
@@ -2104,8 +2114,11 @@ TEST_P(synchronize_changed_qml_documents, types_in_qmldir_only)
Field("Type::exportedTypes",
&Type::exportedTypes,
UnorderedElementsAre(
IsExportedType(pathModuleId, "First", -1, -1),
IsExportedType(exampleModuleId, "FirstType", 1, 0))))))),
IsExportedType(pathModuleId,
"First",
VersionNumber::noVersion,
VersionNumber::noVersion),
IsExportedType(exampleModuleId, "FirstType", 1U, 0U))))))),
Field("SynchronizationPackage::updatedSourceIds",
&SynchronizationPackage::updatedSourceIds,
Contains(qmlDocument1SourceId)))));
@@ -2196,8 +2209,8 @@ TEST_P(synchronize_changed_qml_documents, types_without_qmldir)
EXPECT_CALL(
projectStorageMock,
synchronize(
AllOf(Field("SynchronizationPackage::types",
synchronize(AllOf(
Field("SynchronizationPackage::types",
&SynchronizationPackage::types,
AllOf(Not(Contains(Field("Type::typeName", &Type::typeName, "First.qml"))),
Contains(AllOf(IsStorageType("First2.qml",
@@ -2208,8 +2221,11 @@ TEST_P(synchronize_changed_qml_documents, types_without_qmldir)
Field("Type::exportedTypes",
&Type::exportedTypes,
Conditional(isAdded,
UnorderedElementsAre(IsExportedType(
pathModuleId, "First2", -1, -1)),
UnorderedElementsAre(
IsExportedType(pathModuleId,
"First2",
VersionNumber::noVersion,
VersionNumber::noVersion)),
IsEmpty())))))),
Field("SynchronizationPackage::updatedSourceIds",
&SynchronizationPackage::updatedSourceIds,
@@ -2480,8 +2496,8 @@ TEST_P(synchronize_not_existing_qml_documents, types_in_qmldir_only)
EXPECT_CALL(
projectStorageMock,
synchronize(AllOf(
Field("SynchronizationPackage::types",
synchronize(
AllOf(Field("SynchronizationPackage::types",
&SynchronizationPackage::types,
Conditional(isRemoved,
UnorderedElementsAre(
@@ -2493,7 +2509,10 @@ TEST_P(synchronize_not_existing_qml_documents, types_in_qmldir_only)
Field("Type::exportedTypes",
&Type::exportedTypes,
UnorderedElementsAre(
IsExportedType(pathModuleId, "First", -1, -1)))),
IsExportedType(pathModuleId,
"First",
VersionNumber::noVersion,
VersionNumber::noVersion)))),
AllOf(IsStorageType("First2.qml",
ImportedType{},
TypeTraits{},
@@ -2502,7 +2521,10 @@ TEST_P(synchronize_not_existing_qml_documents, types_in_qmldir_only)
Field("Type::exportedTypes",
&Type::exportedTypes,
UnorderedElementsAre(
IsExportedType(pathModuleId, "First2", -1, -1)))),
IsExportedType(pathModuleId,
"First2",
VersionNumber::noVersion,
VersionNumber::noVersion)))),
AllOf(IsStorageType("Second.qml",
ImportedType{},
TypeTraits{},
@@ -2511,13 +2533,17 @@ TEST_P(synchronize_not_existing_qml_documents, types_in_qmldir_only)
Field("Type::exportedTypes",
&Type::exportedTypes,
UnorderedElementsAre(
IsExportedType(pathModuleId, "Second", -1, -1))))),
IsExportedType(pathModuleId,
"Second",
VersionNumber::noVersion,
VersionNumber::noVersion))))),
IsEmpty())),
Field("SynchronizationPackage::updatedSourceIds",
&SynchronizationPackage::updatedSourceIds,
Conditional(isRemoved,
IsSupersetOf(
{qmlDocument1SourceId, qmlDocument1_2SourceId, qmlDocument2SourceId}),
IsSupersetOf({qmlDocument1SourceId,
qmlDocument1_2SourceId,
qmlDocument2SourceId}),
IsEmpty())))));
updater.update(update);
@@ -2683,7 +2709,7 @@ TEST_P(synchronize_not_existing_qml_documents, without_parsed_type_if_qml_docume
Contains(Field("Type::exportedTypes",
&Type::exportedTypes,
UnorderedElementsAre(IsExportedType(
exampleModuleId, "FirstType", 1, 0)))),
exampleModuleId, "FirstType", 1U, 0U)))),
IsEmpty())),
Field("SynchronizationPackage::updatedSourceIds",
&SynchronizationPackage::updatedSourceIds,
@@ -2759,10 +2785,13 @@ TEST_F(ProjectStorageUpdater_synchronize_qml_documents,
UnorderedElementsAre(
Field("Type::exportedTypes",
&Type::exportedTypes,
UnorderedElementsAre(IsExportedType(exampleModuleId, "FirstType", 1, 0),
IsExportedType(exampleModuleId, "FirstType", 1, 1),
IsExportedType(exampleModuleId, "FirstType", 6, 0),
IsExportedType(pathModuleId, "First", -1, -1))))))));
UnorderedElementsAre(IsExportedType(exampleModuleId, "FirstType", 1U, 0U),
IsExportedType(exampleModuleId, "FirstType", 1U, 1U),
IsExportedType(exampleModuleId, "FirstType", 6U, 0U),
IsExportedType(pathModuleId,
"First",
VersionNumber::noVersion,
VersionNumber::noVersion))))))));
updater.update({.projectDirectory = "/path"});
}
@@ -2785,9 +2814,12 @@ TEST_F(ProjectStorageUpdater_synchronize_qml_documents,
UnorderedElementsAre(
Field("Type::exportedTypes",
&Type::exportedTypes,
UnorderedElementsAre(IsExportedType(exampleModuleId, "FirstType", 1, 0),
IsExportedType(exampleModuleId, "FirstType2", 1, 0),
IsExportedType(pathModuleId, "First", -1, -1))))))));
UnorderedElementsAre(IsExportedType(exampleModuleId, "FirstType", 1U, 0U),
IsExportedType(exampleModuleId, "FirstType2", 1U, 0U),
IsExportedType(pathModuleId,
"First",
VersionNumber::noVersion,
VersionNumber::noVersion))))))));
updater.update({.projectDirectory = "/path"});
}
@@ -2806,7 +2838,7 @@ TEST_F(ProjectStorageUpdater_synchronize_qml_documents, dont_synchronize_selecto
&SynchronizationPackage::types,
Contains(Field("Type::exportedTypes",
&Type::exportedTypes,
Contains(IsExportedType(exampleModuleId, "FirstType", 1, 0))))))));
Contains(IsExportedType(exampleModuleId, "FirstType", 1U, 0U))))))));
updater.update({.qtDirectories = {"/path"}});
}
@@ -3499,8 +3531,11 @@ TEST_P(watcher_document_changes, types)
Conditional(isDirectorAndQmldirUnchanged,
IsEmpty(),
UnorderedElementsAre(
IsExportedType(exampleModuleId, "FirstType", 1, 0),
IsExportedType(pathModuleId, "First", -1, -1))))),
IsExportedType(exampleModuleId, "FirstType", 1U, 0U),
IsExportedType(pathModuleId,
"First",
VersionNumber::noVersion,
VersionNumber::noVersion))))),
AllOf(Conditional(isDocumentUnchanged,
IsStorageType("Second.qml",
ImportedType{},
@@ -3520,10 +3555,16 @@ TEST_P(watcher_document_changes, types)
Conditional(
noSecondTypeInQmldir,
UnorderedElementsAre(
IsExportedType(pathModuleId, "Second", -1, -1)),
IsExportedType(pathModuleId,
"Second",
VersionNumber::noVersion,
VersionNumber::noVersion)),
UnorderedElementsAre(
IsExportedType(exampleModuleId, "SecondType", 2, 2),
IsExportedType(pathModuleId, "Second", -1, -1))))))))),
IsExportedType(exampleModuleId, "SecondType", 2U, 2U),
IsExportedType(pathModuleId,
"Second",
VersionNumber::noVersion,
VersionNumber::noVersion))))))))),
Field("SynchronizationPackage::updatedSourceIds",
&SynchronizationPackage::updatedSourceIds,
Conditional(isIgnoredPartId,
@@ -3786,7 +3827,7 @@ TEST_P(watcher_document_not_existing, types)
Field("Type::exportedTypes",
&Type::exportedTypes,
UnorderedElementsAre(IsExportedType(
exampleModuleId, "FirstType", 1, 0))))),
exampleModuleId, "FirstType", 1U, 0U))))),
Contains(AllOf(IsStorageType("Second.qml",
ImportedType{},
TypeTraitsKind::None,
@@ -3795,7 +3836,7 @@ TEST_P(watcher_document_not_existing, types)
Field("Type::exportedTypes",
&Type::exportedTypes,
UnorderedElementsAre(IsExportedType(
exampleModuleId, "SecondType", 2, 2)))))
exampleModuleId, "SecondType", 2U, 2U)))))
.Times(noSecondTypeInQmldir ? 0 : 1)))),
Field("SynchronizationPackage::updatedSourceIds",
&SynchronizationPackage::updatedSourceIds,