1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5\page qmllint-warnings-and-errors-recursion-depth-errors.html
6\ingroup qmllint-warnings-and-errors
8\title Recursion Depths Errors
9\brief Qml statement or expression is too deeply nested.
11\section1 Maximum Statement Or Expression Depth Exceeded
12\section2 What happened?
13A QML statement or expression was too deeply nested for the compiler. This usually only happens for
14generated code where statements or expressions can be very long, as the recursion limit is usually
15large enough for any sensible QML document.
17\section2 Why is this bad?
18The QML engine will not be able to run this code.
26 let x = 1 + 1 + .... + 1 // maximum depth exceeded: add too many ones together
30 Item { Item { .... } } // maximum depth exceeded: too many nested Item's
34You can fix this warning by auto-generating smaller code pieces. You could split deeply nested
35Components in multiple files or inline components, or split deeply nested expressions into multiple
42 let x = 1 + 1 + .... + 1 // first half of the split
43 x += 1 + 1 + .... + 1 // second half of the split
47 component NestedItem : Item { Item {... }} // first half of the nested Item
48 component DeeplyNestedItem: Item { ... NestedItem{} ... } // second half of the nested Items + NestedItem