slint/tests/cases/expr
Simon Hausmann 00471449b4 Fix compilation of Rust generated code when the generated code uses a return statement inside a block
We cast the result of the body of functions or binding expressions to
the target type via `as _`. When the code contains a return expression,
that works fine, because `return`'s type is the never type, which can be
coerced to a value of any type. However when the return statement is
inside a sub-block, the type becomes `()`, for which the `as _` cast
fails.

Work around this by attempting to detect the situation (return produces
Type::Invalid) and omit the trailing cast.
2023-03-22 18:07:34 +01:00
..
abs.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
acos.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
animation_tick.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
arithmetic.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
asin.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
atan.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
ceil.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
comparison.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
cos.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
debug.slint Move lone tests to sub-folder 2022-05-06 09:56:39 +02:00
floor.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
log.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
math.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
minmax.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
mod.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
pow.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
return.slint Fix compilation of Rust generated code when the generated code uses a return statement inside a block 2023-03-22 18:07:34 +01:00
round.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
sin.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
sqrt.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
string_concatenation.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
string_template.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
tan.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00
trigo.slint Rust: Make new(), run() and show() report errors from the backend 2023-02-10 05:00:03 +01:00