summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/scripts/parser/warnings/standalone_expression.gd
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-05-17 13:00:33 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-05-17 13:00:33 +0200
commitb569ae3ddc6834eda566eb94ca18e475deed0a84 (patch)
tree4c976e4b8efaacc32c35f0ae53c4ce7818ce5735 /modules/gdscript/tests/scripts/parser/warnings/standalone_expression.gd
parent5b341621e6cdcf0f3a37a432b7fef2fce1e1cf00 (diff)
parent7dd801c580bc27cabe3dd1f2475d90efcf3c3197 (diff)
downloadredot-engine-b569ae3ddc6834eda566eb94ca18e475deed0a84.tar.gz
Merge pull request #92027 from dalexeev/gds-fix-standalone-expression-for-preload
GDScript: Fix `STANDALONE_EXPRESSION` warning for `preload()`
Diffstat (limited to 'modules/gdscript/tests/scripts/parser/warnings/standalone_expression.gd')
-rw-r--r--modules/gdscript/tests/scripts/parser/warnings/standalone_expression.gd13
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/parser/warnings/standalone_expression.gd b/modules/gdscript/tests/scripts/parser/warnings/standalone_expression.gd
index dc4223ec2d..74f42b012b 100644
--- a/modules/gdscript/tests/scripts/parser/warnings/standalone_expression.gd
+++ b/modules/gdscript/tests/scripts/parser/warnings/standalone_expression.gd
@@ -6,3 +6,16 @@ func test():
Vector3.ZERO
[true, false]
float(125)
+ # The following statements should not produce `STANDALONE_EXPRESSION`:
+ var _a = 1
+ _a = 2 # Assignment is a local (or global) side effect.
+ @warning_ignore("redundant_await")
+ await 3 # The `await` operand is usually a coroutine or a signal.
+ absi(4) # A call (in general) can have side effects.
+ @warning_ignore("return_value_discarded")
+ preload("../../utils.notest.gd") # A static initializer may have side effects.
+ """
+ Python-like "comment".
+ """
+ @warning_ignore("standalone_ternary")
+ 1 if 2 else 3 # Produces `STANDALONE_TERNARY` instead.