-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
bool -> (int, float) and (int, float) -> bool implicit cast removed #40336
base: master
Are you sure you want to change the base?
bool -> (int, float) and (int, float) -> bool implicit cast removed #40336
Conversation
Note that the following code will no longer work:
Explicit conversion will be required:
|
if we support implicit casting between boolean and numerical types than it also needs to support arithmetic operations too. the below line should be valid (it's not now). dir.x = Input.is_key_pressed(KEY_A) - Input.is_key_pressed(KEY_D); |
@ThakeeNathees Is this still desired? If so, this needs to be rebased on the latest master branch. |
866abe3
to
00020e5
Compare
@aaronfranke done |
Sooo what's the status on this? |
This is a compatibility-breaking change, so I think it should be implemented as a GDScript warning instead. (I think this may already exists as "unsafe cast" or "unsafe assignment".) We may want a specific warning for those particular bool-to-int/float cases (and vice versa) though. This one could be enabled by default in projects created after this PR is merged (using the approach described in godotengine/godot-proposals#4834). |
Fix: #40249
Fix #26248