-
Notifications
You must be signed in to change notification settings - Fork 624
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect binding loops when it involve the condition of a
if
in a layout
Fixes #7126
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
internal/compiler/tests/syntax/analysis/binding_loop_layout_if.slint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright © SixtyFPS GmbH <[email protected]> | ||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 | ||
|
||
component Wrapper { | ||
width: 100%; | ||
height: 100%; | ||
|
||
Rectangle { | ||
// ^error{The binding for the property 'layoutinfo-h' is part of a binding loop} | ||
VerticalLayout { | ||
// ^error{The binding for the property 'layoutinfo-h' is part of a binding loop} | ||
if root.width > 200px: Rectangle { } | ||
} | ||
} | ||
} | ||
|
||
component WrapperInherited inherits Rectangle { | ||
// ^error{The binding for the property 'layoutinfo-h' is part of a binding loop} | ||
VerticalLayout { | ||
// ^error{The binding for the property 'layoutinfo-h' is part of a binding loop} | ||
if root.width > 200px: Rectangle { } | ||
} | ||
} | ||
|
||
export component Test inherits Window { | ||
|
||
VerticalLayout { | ||
HorizontalLayout { | ||
// ^error{The binding for the property 'width' is part of a binding loop} | ||
// ^^error{The binding for the property 'width' is part of a binding loop} | ||
// ^^^error{The binding for the property 'layout-cache' is part of a binding loop} | ||
WrapperInherited { } | ||
Wrapper { } | ||
// ^error{The binding for the property 'layoutinfo-h' is part of a binding loop} | ||
} | ||
} | ||
} |