diff options
| author | Olivier De Cannière <olivier.decanniere@qt.io> | 2024-04-18 13:28:39 +0200 |
|---|---|---|
| committer | Olivier De Cannière <olivier.decanniere@qt.io> | 2024-04-23 09:47:01 +0200 |
| commit | d13a6ea1f30acc29ce3d90fb027acc41e6ee9be6 (patch) | |
| tree | 2c56cd26b2c3a8187d314bfb6948e77ca7ab0b77 /src/qmlcompiler/qqmljsregistercontent.cpp | |
| parent | 1126785007af4e7867a17a83ba6c08f262c20ceb (diff) | |
qmlcachegen: Improve warnings for missing return type annotations
Fixes: QTBUG-124220
Pick-to: 6.7
Change-Id: Ic31b90b0408d855a45e17647ab659fbbc6e17633
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsregistercontent.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsregistercontent.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/qmlcompiler/qqmljsregistercontent.cpp b/src/qmlcompiler/qqmljsregistercontent.cpp index fa89dbe0bc..2c5d562e5b 100644 --- a/src/qmlcompiler/qqmljsregistercontent.cpp +++ b/src/qmlcompiler/qqmljsregistercontent.cpp @@ -13,7 +13,6 @@ QString QQmlJSRegisterContent::descriptiveName() const if (m_storedType.isNull()) return u"(invalid type)"_s; - QString result = m_storedType->internalName() + u" of "_s; const auto scope = [this]() -> QString { if (m_scope.isNull()) return u"(invalid type)::"_s; @@ -25,36 +24,46 @@ QString QQmlJSRegisterContent::descriptiveName() const + u"::"_s; }; + QString result; switch (m_content.index()) { - case Type: - return result - + std::get<std::pair<QQmlJSScope::ConstPtr, int>>(m_content).first->internalName(); + case Type: { + auto contained = std::get<std::pair<QQmlJSScope::ConstPtr, int>>(m_content).first; + result += contained->internalName(); + if (m_storedType->internalName() != contained->internalName()) + result += u" stored as "_s + m_storedType->internalName(); + return result; + } case Property: { const QQmlJSMetaProperty prop = std::get<PropertyLookup>(m_content).property; - return result + scope() + prop.propertyName() + u" with type "_s + prop.typeName(); + result += scope() + prop.propertyName() + u" with type "_s + prop.typeName(); + if (m_storedType->internalName() != prop.typeName()) + result += u" (stored as "_s + m_storedType->internalName() + u")"; + return result; } case Method: { const auto methods = std::get<QList<QQmlJSMetaMethod>>(m_content); if (methods.isEmpty()) - return result + scope() + u"(unknown method)"_s; + result = scope() + u"(unknown method)"_s; else - return result + scope() + methods[0].methodName() + u"(...)"_s; + result = scope() + methods[0].methodName() + u"(...)"_s; + return result + u" (stored as "_s + m_storedType->internalName() + u")"; } case Enum: { const auto e = std::get<std::pair<QQmlJSMetaEnum, QString>>(m_content); if (e.second.isEmpty()) - return result + scope() + e.first.name(); + result = scope() + e.first.name(); else - return result + scope() + e.first.name() + u"::"_s + e.second; + result = scope() + e.first.name() + u"::"_s + e.second; + return result + u" (stored as "_s + m_storedType->internalName() + u")"; } case ImportNamespace: { return u"import namespace %1"_s.arg(std::get<uint>(m_content)); } case Conversion: { - return u"conversion to %1"_s.arg( - std::get<ConvertedTypes>(m_content).result->internalName()); + return u"conversion to %1"_s.arg(std::get<ConvertedTypes>(m_content).result->internalName()); } } + Q_UNREACHABLE_RETURN(result + u"wat?"_s); } |
