summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/scripts/analyzer/errors
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2023-08-24 19:01:31 +0300
committerDanil Alexeev <danil@alexeev.xyz>2023-08-25 17:04:04 +0300
commit68a567bd1389a2cb410fc002632ccd5b5fb59f5c (patch)
treeca598ea014cdf97d123d526a5af00f85acd3845f /modules/gdscript/tests/scripts/analyzer/errors
parent6758a7f8c07d1f4c8ec4f052ded6d26402967ebe (diff)
downloadredot-engine-68a567bd1389a2cb410fc002632ccd5b5fb59f5c.tar.gz
GDScript: Allow use local constants as types
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer/errors')
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_before_declared.gd5
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_before_declared.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_const.gd5
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_const.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_type.gd5
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_type.out2
6 files changed, 21 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_before_declared.gd b/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_before_declared.gd
new file mode 100644
index 0000000000..7cdc14685f
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_before_declared.gd
@@ -0,0 +1,5 @@
+enum MyEnum {}
+
+func test():
+ var e: E
+ const E = MyEnum
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_before_declared.out b/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_before_declared.out
new file mode 100644
index 0000000000..e1d5837f32
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_before_declared.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Local constant "E" is not resolved at this point.
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_const.gd b/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_const.gd
new file mode 100644
index 0000000000..68cf5efd8b
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_const.gd
@@ -0,0 +1,5 @@
+enum MyEnum {}
+
+func test():
+ var E = MyEnum
+ var e: E
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_const.out b/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_const.out
new file mode 100644
index 0000000000..b1f4e7a2c8
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_const.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Local variable "E" cannot be used as a type.
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_type.gd b/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_type.gd
new file mode 100644
index 0000000000..ac446183cb
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_type.gd
@@ -0,0 +1,5 @@
+enum MyEnum {A}
+
+func test():
+ const E = MyEnum.A
+ var e: E
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_type.out b/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_type.out
new file mode 100644
index 0000000000..c3c2c8ca2f
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/local_const_as_type_use_not_type.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Local constant "E" is not a valid type.