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

A bug with booleans, rust slint. #5132

Closed
Sorinca opened this issue Apr 24, 2024 · 3 comments
Closed

A bug with booleans, rust slint. #5132

Sorinca opened this issue Apr 24, 2024 · 3 comments

Comments

@Sorinca
Copy link

Sorinca commented Apr 24, 2024

Hi, this is on a windows intel machine, I am codding in rust. When I write this bit of code it throws this error

------------------------------------------------------------------------------------------------------------------------------------------------------
init => { 
            if Intermediar-elev.new==true{
                Intermediar-elev.new=false;
            }
            if Intermediar-elev.new==false{
                Intermediar-elev.state==false;
            }
        }

------------------------------------------------------------------------------------------------------------------------------------------------------
error[E0605]: non-primitive cast: `()` as `bool`
    --> C:\Users\sami2\Desktop\da\da\biblioteca\target\debug\build\biblioteca-6a35604a473275b1\out\appwindow.rs:8087:22
     |
8087 | /                      ({
8088 | |                          }
8089 | |                     ) as _ }
     | |__________________________^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
------------------------------------------------------------------------------------------------------------------------------------------------------

I use the bools elsewhere and its fine and after deleting is inside the init it compiles ok. I am up to provide more information if asked.
Sorry for my bad english.
Thanks.

@Sorinca
Copy link
Author

Sorinca commented Apr 24, 2024

It was because I was using the "==" instead of "=" on "Intermediar-elev.state==false;". I am stupid.

@Sorinca
Copy link
Author

Sorinca commented Apr 24, 2024

yap

@Sorinca Sorinca closed this as completed Apr 24, 2024
@ogoffart
Copy link
Member

Thanks for reporting a bug.
Compilation error in the generated code is a bug in Slint because it should have either been a compilation error in the Slint code, or be accepted.
In this case, this bug was already fixed in commit 028d075 (issue #4942)
But thanks anyway for reporting.

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

No branches or pull requests

2 participants