mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-20 20:07:53 +00:00
The compiler was accepting the comparison of types such as color, or
struct, and then later we'd get rust compilation error or interpreter
panic.
Example seen in the crash reporter:
`internal/interpreter/eval.rs:257:35`
```
unsupported Value::Brush(SolidColor(Color { red: 0, green: 0, blue: 0, alpha: 0 })) ≤ Value::Brush(SolidColor(Color { red: 255, green: 0, blue: 0, alpha: 255 }))
```
Note that some code hapenned to compile with rust or C++.
For example, comparison of bool, or anonymous struct (represented as
tuples), or color represeted as int)
So technically this is a breaking change.
But this should be fine as this was not working in the interpreter and
this is a bug fix.
ChangeLog: Slint compilation error for comparison of types that can't be
compared with less or greater operator.
15 lines
802 B
Text
15 lines
802 B
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
|
|
|
|
export component C {
|
|
|
|
out property <bool> color-cmp: Colors.red > Colors.blue;
|
|
// ^error{Values of type color cannot be compared}
|
|
out property <bool> bool-cmp: true > false;
|
|
// ^error{Values of type bool cannot be compared}
|
|
out property <bool> string-cmp: "eee" > "ddd";
|
|
out property <bool> array-cmp: [45] < [45];
|
|
// ^error{Values of type \[float\] cannot be compared}
|
|
out property <bool> struct-cmp: { foo: 45 } <= { foo: 45 };
|
|
// ^error{Values of type \{ foo: float,\} cannot be compared}
|
|
}
|