mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-29 05:14:48 +00:00
![]() The following scenario would fail compiling to C++ because we failed to determine the return type of the conditional expression: Test := Rectangle { property<bool> condition; property<color> extra_color; color: condition ? root.extra_color : 4289374890; } The type of the true branch would be color and the false branch would be a float. Since they "disagree", ty() on the expression would return Type::Invalid. This was temporarily worked around in the C++ generator by always returning the type of the true branch, but that's wrong. Instead this patch changes maybe_convert_to to apply the Cast expression to the individual branches, placing the cast only to the numberic literal and correcting the return value of ty() on the conditional expression. |
||
---|---|---|
.. | ||
cpp.rs | ||
rust.rs |