1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-19 14:31:59 +00:00

Add STATIC_CALLED_ON_INSTANCE warning to highlight

when static functions are called directly from objects
This commit is contained in:
clayjohn
2022-10-13 12:42:11 -07:00
parent 39534a7aec
commit 0a51bb4ca5
6 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
class Player:
var x = 3
func test():
# These should not emit a warning.
var _player = Player.new()
print(String.num_uint64(8589934592)) # 2 ^ 33
# This should emit a warning.
var some_string = String()
print(some_string.num_uint64(8589934592)) # 2 ^ 33

View File

@@ -0,0 +1,7 @@
GDTEST_OK
>> WARNING
>> Line: 11
>> STATIC_CALLED_ON_INSTANCE
>> The function 'num_uint64()' is a static function but was called from an instance. Instead, it should be directly called from the type: 'String.num_uint64()'.
8589934592
8589934592