slint/sixtyfps_compiler/passes
Simon Hausmann 03bef6dba3 Fix casting with conditional expressions
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.
2020-06-11 13:38:24 +02:00
..
collect_resources.rs Minor cleanup in function naming 2020-06-10 09:27:54 +02:00
inlining.rs Keep a reference to the AST node in the Element structure 2020-06-09 18:20:32 +02:00
lower_layout.rs Grid layout in the interpreter 2020-06-10 19:40:47 +02:00
move_declarations.rs Add GridLayout and Row 2020-06-09 12:46:16 +02:00
resolving.rs Fix casting with conditional expressions 2020-06-11 13:38:24 +02:00
unique_id.rs Add a pass to assign unique id to the elements 2020-05-27 08:20:52 +02:00