mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 22:31:14 +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. |
||
---|---|---|
.. | ||
generator | ||
parser | ||
parser_test_macro | ||
passes | ||
tests | ||
Cargo.toml | ||
diagnostics.rs | ||
expression_tree.rs | ||
generator.rs | ||
layout.rs | ||
lib.rs | ||
object_tree.rs | ||
parser.rs | ||
typeregister.rs |