Add STATIC_CALLED_ON_INSTANCE warning to highlight
when static functions are called directly from objects
This commit is contained in:
parent
39534a7aec
commit
0a51bb4ca5
6 changed files with 31 additions and 0 deletions
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue