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

GDScript: Infer type with string format operator #90448

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

vnen
Copy link
Member

@vnen vnen commented Apr 9, 2024

If the left value type is known to be String, assume the format operator (%) will return a string, since it works with any type in the right hand side. This is also used by type inference even if the right hand type is unknown at compile time.

Fix #88082

@vnen vnen requested a review from a team as a code owner April 9, 2024 18:52
@dalexeev dalexeev added this to the 4.3 milestone Apr 10, 2024
If the left value type is known to be String, assume the format operator
(`%`) will return a string, since it works with any type in the right
hand side. This is also used by type inference even if the right hand
type is unknown at compile time.
@vnen vnen force-pushed the gdscript-infer-string-format branch from 5adc22d to 4bdba71 Compare April 10, 2024 14:49
@akien-mga akien-mga merged commit 67076c1 into godotengine:master Apr 10, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@vnen vnen deleted the gdscript-infer-string-format branch April 15, 2024 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GDScript: cannot infer the type of a variable if its a format string
3 participants