Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error non-primitive cast when returning nothing in key-released callback #3962

Closed
qarmin opened this issue Nov 19, 2023 · 0 comments · Fixed by #3965
Closed

Compilation error non-primitive cast when returning nothing in key-released callback #3962

qarmin opened this issue Nov 19, 2023 · 0 comments · Fixed by #3965

Comments

@qarmin
Copy link

qarmin commented Nov 19, 2023

Slint 1.3.0

Probably this is caused by returning none in this function

export component SelectableTableView {
    focus_item := FocusScope {
        key-released(event) => {
            debug(event);
            if (!self.visible) {
                return;
            }
            accept
        }
    }
}

This works in lsp but compilation throws error

error[E0605]: non-primitive cast: `()` as `EventResult`
     --> /home/rafal/Projekty/Rust/czkawka/target/debug/build/krokiet-525b5ee05e6ac701/out/main_window.rs:11186:34
      |
11186 | / ...                    ({
11187 | | ...                        }
11188 | | ...                   ) as _ }
      | |____________________________^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object

Probably this is commit which caused problem - qarmin/czkawka@796233c

ogoffart added a commit that referenced this issue Nov 20, 2023
Previously we were likely to get error in the compiled code anyway.
(although the interpreter worked fine)

Fixes #3962
ogoffart added a commit that referenced this issue Nov 20, 2023
Previously we were likely to get error in the compiled code anyway.
(although the interpreter worked fine)

Fixes #3962
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant