Logo
Explore Help
Sign In
seedlingattempt/godot
1
0
Fork 0
You've already forked godot
Code Issues Pull Requests Actions Packages Projects Releases Wiki Activity
Files
413490c270ddf400ab8da39ca97e097fc42ea409
godot/modules/gdscript/tests/scripts/parser/warnings/unassigned_variable.gd

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
269 B
GDScript3
Raw Normal View History

Add dozens of new integration tests to the GDScript test suite This also ignores `.out` files in the file format static checks.
2021-04-19 20:50:52 +02:00
func test():
GDScript: Don't warn on unassigned for builtin-typed variables If the type of a variable is a built-in Variant type, then it will automatically be assigned a default value based on the type. This means that the explicit initialization may be unnecessary. Thus this commit removes the warning in such case. This also changes the meaning of the unassigned warning to happen when the variable is used before being assigned, not when it has zero assignments.
2024-04-09 14:15:51 -03:00
var unassigned
print(unassigned)
unassigned = "something" # Assigned only after use.
var a
print(a) # Unassigned, warn.
if a: # Still unassigned, warn.
a = 1
print(a) # Assigned (dead code), don't warn.
print(a) # "Maybe" assigned, don't warn.
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.1 Page: 618ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API