slint/internal/compiler/tests/syntax/lookup/if.slint
Olivier Goffart 82ae83ce8c Parser: don't have the whitespace as part of an expression
That way the error for an expression is at a better location, and
this also prevent the formater that removes space in expressions to
remove the spaces before the expression that shouldn't be removed
2023-04-14 17:46:19 +02:00

28 lines
587 B
Text

// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
export Hello := Rectangle {
width: 100phx;
height: 100phx;
background: white;
property<length> top_level: 42phx;
property<bool> cond1;
property<bool> cond2;
property<bool> cond3;
if (cond1) : Rectangle {
background: root.background;
property<length> xx: root.top_level;
}
if (cond1 ? cond2 : cond3) : Rectangle {
}
if (width) : Rectangle {
// ^error{Cannot convert length to bool}
}
}