From 3396b254891db02edb29950e7a2a1c1968612949 Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Sat, 13 Nov 2021 18:40:53 +0300 Subject: Allow using built-in names for variables, push warnings instead --- .../tests/scripts/parser/warnings/shadowed_global_identifier.gd | 2 ++ .../tests/scripts/parser/warnings/shadowed_global_identifier.out | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.gd create mode 100644 modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.out (limited to 'modules/gdscript/tests/scripts/parser') diff --git a/modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.gd b/modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.gd new file mode 100644 index 0000000000..3c64be571b --- /dev/null +++ b/modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.gd @@ -0,0 +1,2 @@ +func test(): + var abs = "This variable has the same name as the built-in function." diff --git a/modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.out b/modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.out new file mode 100644 index 0000000000..f2b29e5bad --- /dev/null +++ b/modules/gdscript/tests/scripts/parser/warnings/shadowed_global_identifier.out @@ -0,0 +1,9 @@ +GDTEST_OK +>> WARNING +>> Line: 2 +>> SHADOWED_GLOBAL_IDENTIFIER +>> The local variable 'abs' has the same name as a built-in function. +>> WARNING +>> Line: 2 +>> UNUSED_VARIABLE +>> The local variable 'abs' is declared but never used in the block. If this is intended, prefix it with an underscore: '_abs' -- cgit v1.2.3