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-alias-cycle.html
6\ingroup qmllint-warnings-and-errors
9\brief Alias property is part of an alias cycle.
11\section1 Alias Property Is Part Of An Alias Cycle
13\section2 What happened?
14A \l{QML Object Attributes#property-aliases}{property alias} resolves to itself or to another
15alias resolving to itself.
17Usually, \l{QML Object Attributes#property-aliases}{a property alias} should reference another
18property either directly, or indirectly by passing through another alias property.
20If a property alias directly or indirectly references itself, then it forms an alias cycle.
21The warning indicates that the current alias property is inside or references
22an alias cycle, see \l{#example}{Example}.
24\section2 Why is this bad?
25Instances of components with alias cycles will not be created at runtime: they will be null instead.
33 property alias myself: someId.myself // not ok: referring to itself
35 property alias cycle: someId.cycle2 // not ok: indirectly referring to itself
36 property alias cycle2: someId.cycle
38 property alias indirect: someId.cycle // not ok: referring to alias indirectly referring to itself
41You can fix this warning by breaking up the alias cycles:
49 property string myself
52 property alias myself: anotherId.myself // ok: referring to a property
54 property alias cycle: someId.cycle2 // ok: does not refer to itself anymore
55 property alias cycle2: anotherId.cycle // ok: not a cycle anymore
57 property alias indirect: someId.cycle // ok: cycle does not form an alias cycle anymore