mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-20 07:12:28 +00:00

In 80de96488a
(#3397) we introduced a new
error if we detect a binding loop from the Window geomerty to its layout.
But it looks like this causes a lot of error in existing project, so
make it a warning instead.
It will continue to be an error in the live preview as this will cause a
panic otherwise.
This commit also change the text of the error to include the actual
binding loop. I hope this makes it easier for users to see the loop and
help to fix it.
46 lines
1.7 KiB
Text
46 lines
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
|
|
|
|
global G := {
|
|
// ^warning{':=' to declare a global is deprecated. Remove the ':='}
|
|
property <int> alala <=> alala;
|
|
// ^error{Property cannot alias to itself}
|
|
property <string> yoyo <=> alala;
|
|
// ^error{The property does not have the same type as the bound property}
|
|
}
|
|
|
|
export X := Rectangle {
|
|
// ^warning{':=' to declare a component is deprecated. The new syntax declare components with 'component MyComponent {'. Read the documentation for more info}
|
|
|
|
property <brush> my_color <=> self.background;
|
|
x <=> y;
|
|
width <=> self.height;
|
|
|
|
|
|
border_color <=> blue;
|
|
// ^error{The expression in a two way binding must be a property reference}
|
|
border_width <=> 4px + 4px;
|
|
// ^error{The expression in a two way binding must be a property reference}
|
|
|
|
xx := Rectangle {
|
|
x: 42phx;
|
|
width <=> parent.width;
|
|
height <=> x;
|
|
background <=> root.x;
|
|
// ^error{The property does not have the same type as the bound property}
|
|
y <=> y;
|
|
// ^error{Property cannot alias to itself}
|
|
}
|
|
|
|
property <int> dd <=> dd;
|
|
// ^error{Property cannot alias to itself}
|
|
|
|
Rectangle {
|
|
x <=> self.loop_on_x;
|
|
// ^error{The binding for the property 'x' is part of a binding loop (x -> loop-on-x)}
|
|
property <length> loop_on_x <=> x;
|
|
// ^error{The binding for the property 'loop-on-x' is part of a binding loop (x -> loop-on-x)}
|
|
}
|
|
|
|
property gyoyo <=> G.yoyo;
|
|
}
|