slint/sixtyfps_compiler/tests/syntax/basic/comparison_operator.60
Simon Hausmann 765f2790ba Fix failing syntax tests
After commit 0c8a31211e we're using an
older version of the regex crate, that uncovered a bug in our tests:

We were looking for

   Use parentheses to disambiguate && and ||

in the output messages by interpreting this as a regular expression. The
newer version of regex considered the || in the above regex as
alternations, empty alternations. So they basically always matched.

The old regexp that's pinned due to the above commit doesn't support
empty alternations, so the || need to be escaped. That uncovered a bug
in the regex itself, where it turns out that the word "between" was
missing after "disambiguate".
2020-10-12 16:37:21 +02:00

27 lines
1.2 KiB
Text

/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2020 Olivier Goffart <olivier.goffart@sixtyfps.io>
Copyright (c) 2020 Simon Hausmann <simon.hausmann@sixtyfps.io>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact info@sixtyfps.io for more information.
LICENSE END */
SuperSimple := Rectangle {
property<bool> zz: aa > bb == cc
// ^error{Use parentheses to disambiguate equality expression on the same level}
< dd;
// ^error{Use parentheses to disambiguate equality expression on the same level}
property<bool> yy: aa <= bb <= cc;
// ^error{Use parentheses to disambiguate equality expression on the same level}
property<bool> xx: aa<bb>(d);
// ^error{Use parentheses to disambiguate equality expression on the same level}
property<bool> ww: aa && dd && ee || cc ==
// ^error{Use parentheses to disambiguate between && and \|\|}
dd == ee;
// ^error{Use parentheses to disambiguate equality expression on the same level}
}