You've already forked godot
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:
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user