diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 65069cff59e..b90236e026b 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -942,6 +942,9 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId, if (checkTypeForDesignerSupport(typeId)) addMessage(WarnUnsupportedTypeInVisualDesigner, typeErrorLocation, typeName); + if (QFileInfo(_doc->fileName()).baseName() == getRightMostIdentifier(typeId)->name.toString()) + addMessage(ErrTypeIsInstantiatedRecursively, typeErrorLocation, typeName); + if (checkTypeForQmlUiSupport(typeId)) addMessage(ErrUnsupportedTypeInQmlUi, typeErrorLocation, typeName); diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.cpp b/src/libs/qmljs/qmljsstaticanalysismessage.cpp index 4bbd00bbf5d..10f918abe47 100644 --- a/src/libs/qmljs/qmljsstaticanalysismessage.cpp +++ b/src/libs/qmljs/qmljsstaticanalysismessage.cpp @@ -245,6 +245,8 @@ StaticAnalysisMessages::StaticAnalysisMessages() tr("Duplicate import (%1)."), 1); newMsg(ErrHitMaximumRecursion, Error, tr("Hit maximum recursion limit when visiting AST.")); + newMsg(ErrTypeIsInstantiatedRecursively, Error, + tr("Type cannot be instantiated recursively (%1)."), 1); } } // anonymous namespace diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.h b/src/libs/qmljs/qmljsstaticanalysismessage.h index 50a70ab2096..64a8baa4e00 100644 --- a/src/libs/qmljs/qmljsstaticanalysismessage.h +++ b/src/libs/qmljs/qmljsstaticanalysismessage.h @@ -89,6 +89,7 @@ enum Type MaybeWarnEqualityTypeCoercion = 126, WarnConfusingExpressionStatement = 127, StateCannotHaveChildItem = 128, + ErrTypeIsInstantiatedRecursively = 129, HintDeclarationsShouldBeAtStartOfFunction = 201, HintOneStatementPerLine = 202, WarnImperativeCodeNotEditableInVisualDesigner = 203,