QmlJS: Suppress wrong warning

When a type is created inside a file with the same name
do not warn if the created type is namespaced.

Fixes: QTCREATORBUG-24615
Change-Id: Icb2b1a9fd1a02ee222084b676ee818eed65a7c93
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Christian Stenger
2021-05-06 08:54:36 +02:00
parent 11dcdb74ef
commit fd64253a62

View File

@@ -939,13 +939,13 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
if (checkTypeForDesignerSupport(typeId))
addMessage(WarnUnsupportedTypeInVisualDesigner, typeErrorLocation, typeName);
if (QFileInfo(_doc->fileName()).baseName() == getRightMostIdentifier(typeId)->name.toString())
if (typeId->next == nullptr && QFileInfo(_doc->fileName()).baseName() == typeName)
addMessage(ErrTypeIsInstantiatedRecursively, typeErrorLocation, typeName);
if (checkTypeForQmlUiSupport(typeId))
addMessage(ErrUnsupportedTypeInQmlUi, typeErrorLocation, typeName);
if (m_typeStack.count() > 1 && getRightMostIdentifier(typeId)->name.toString() == "State") {
if (m_typeStack.count() > 1 && typeName == "State") {
addMessage(WarnStatesOnlyInRootItemForVisualDesigner, typeErrorLocation);
addMessage(ErrStatesOnlyInRootItemInQmlUi, typeErrorLocation);
}