From b004f8180e37d1d3a6f06bb5f7f6992b8f0ad5d2 Mon Sep 17 00:00:00 2001 From: Danil Alexeev Date: Wed, 18 Jan 2023 20:12:33 +0300 Subject: GDScript: Allow constant expressions in annotations --- .../features/annotation_constant_expression_parameters.gd | 10 ++++++++++ .../features/annotation_constant_expression_parameters.out | 1 + .../scripts/analyzer/features/warning_ignore_annotation.gd | 6 +++--- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.gd create mode 100644 modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.out (limited to 'modules/gdscript/tests/scripts/analyzer/features') diff --git a/modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.gd b/modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.gd new file mode 100644 index 0000000000..272dce8bbe --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.gd @@ -0,0 +1,10 @@ +const BEFORE = 1 + +@export_range(-10, 10) var a = 0 +@export_range(1 + 2, absi(-10) + 1) var b = 5 +@export_range(BEFORE + 1, BEFORE + AFTER + 1) var c = 5 + +const AFTER = 10 + +func test(): + pass diff --git a/modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.out b/modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.out new file mode 100644 index 0000000000..d73c5eb7cd --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/annotation_constant_expression_parameters.out @@ -0,0 +1 @@ +GDTEST_OK diff --git a/modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd b/modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd index 877a4ea221..4c02fd4b0d 100644 --- a/modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd +++ b/modules/gdscript/tests/scripts/analyzer/features/warning_ignore_annotation.gd @@ -1,12 +1,12 @@ -@warning_ignore(unused_private_class_variable) +@warning_ignore("unused_private_class_variable") var _unused = 2 -@warning_ignore(unused_variable) +@warning_ignore("unused_variable") func test(): print("test") var unused = 3 - @warning_ignore(redundant_await) + @warning_ignore("redundant_await") print(await regular_func()) print("done") -- cgit v1.2.3