Merge pull request #61666 from nathanfranke/fix-match-bind

gdscript: use correct error for unused bind match, suppress with underscore
This commit is contained in:
George Marques
2022-06-15 10:21:34 -03:00
committed by GitHub
3 changed files with 21 additions and 2 deletions

View File

@@ -0,0 +1,13 @@
# https://github.com/godotengine/godot/pull/61666
func test():
var dict := {"key": "value"}
match dict:
{"key": var value}:
print(value) # used, no warning
match dict:
{"key": var value}:
pass # unused, warning
match dict:
{"key": var _value}:
pass # unused, suppressed warning from underscore

View File

@@ -0,0 +1,6 @@
GDTEST_OK
>> WARNING
>> Line: 9
>> UNUSED_VARIABLE
>> The local variable 'value' is declared but never used in the block. If this is intended, prefix it with an underscore: '_value'
value