slint/internal/compiler/tests/syntax/analysis/binding_loop_layout_if.slint
Olivier Goffart 80de96488a Detect binding loops that applies to the Window itself
The Window geometry depends on its constraints, so its constraints
cannot depends on its geometry

This fixes Infinitely growing layout, and other panics

Fixes #3989
Fixes #2902
Fixes #8065
2025-05-21 10:33:02 +02:00

42 lines
No EOL
1.7 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// 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 {
// ^error{The binding for the property 'layoutinfo-h' is part of a binding loop}
VerticalLayout {
// ^error{The binding for the property 'width' is part of a binding loop}
// ^^error{The binding for the property 'layoutinfo-h' is part of a binding loop}
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}
// ^^^^error{The binding for the property 'layoutinfo-h' is part of a binding loop}
// ^^^^^error{The binding for the property 'width' is part of a binding loop}
WrapperInherited { }
Wrapper { }
// ^error{The binding for the property 'layoutinfo-h' is part of a binding loop}
}
}
}