mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-28 12:54:45 +00:00
![]() 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. |
||
---|---|---|
.. | ||
cpp.rs | ||
rust.rs |