mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
GDScript: Infer type with string format operator
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.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
# GH-88082
|
||||
|
||||
func test():
|
||||
var x = 1
|
||||
var message := "value: %s" % x
|
||||
print(message)
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_OK
|
||||
value: 1
|
||||
Reference in New Issue
Block a user