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
GDScript: Fix constant conversions #71844
GDScript: Fix constant conversions #71844
Conversation
92716fb
to
0815f7d
Compare
0815f7d
to
c7c39d0
Compare
I looked now and assume that the thing that wasn't included here was a correction for wrong check of compatibility when it comes to asymmetric conversions - String can be converted to Color, but other way around will never work. It can be fixed by disallowing implicit conversions in reverse check (reverse check is done only to allow cases where variable of class type is used where subclass is expected, since those are objects no implicit conversions should take place). Updated the PR and fixed the same mistake in usual assignments too. Is there anything else that is missing? |
|
18df701
to
9710bc0
Compare
Needs rebase. |
9710bc0
to
24b39b7
Compare
Needs another rebase to pass CI, I fixed the GDScript test error. |
24b39b7
to
16ef6fd
Compare
16ef6fd
to
31e0ae2
Compare
Thanks! |
A constant value can be converted to a specified type during analysis, not at runtime every time.
Out of those places only variable initializer was handled at compile time before.
Initializer for constants was not converted at all which was leading to many crash reports.
While at it, allowed a cast to be considered as constant expression under certain circumstances (which will be expanded with array PR from which code for this PR partially comes from).
Fixed minor things with casts and arguments validations.
Fixes #70861.
Fixes #71255.
Fixes #71483.
Fixes #71635.
Fixes #72209.
Related to #70872 (supersedes).
Related to #70873 (supersedes).