From ff505c9875fb54a082b7ff4fb28b975754e42048 Mon Sep 17 00:00:00 2001 From: Dmitrii Maganov Date: Sun, 8 Jan 2023 05:41:06 +0200 Subject: GDScript: Fix type for index subscript on constant --- .../tests/scripts/analyzer/errors/constant_subscript_type.gd | 5 +++++ .../tests/scripts/analyzer/errors/constant_subscript_type.out | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 modules/gdscript/tests/scripts/analyzer/errors/constant_subscript_type.gd create mode 100644 modules/gdscript/tests/scripts/analyzer/errors/constant_subscript_type.out (limited to 'modules/gdscript/tests/scripts/analyzer') diff --git a/modules/gdscript/tests/scripts/analyzer/errors/constant_subscript_type.gd b/modules/gdscript/tests/scripts/analyzer/errors/constant_subscript_type.gd new file mode 100644 index 0000000000..87fbe1229c --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/constant_subscript_type.gd @@ -0,0 +1,5 @@ +const base := [0] + +func test(): + var sub := base[0] + if sub is String: pass diff --git a/modules/gdscript/tests/scripts/analyzer/errors/constant_subscript_type.out b/modules/gdscript/tests/scripts/analyzer/errors/constant_subscript_type.out new file mode 100644 index 0000000000..54c190cf8a --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/constant_subscript_type.out @@ -0,0 +1,2 @@ +GDTEST_ANALYZER_ERROR +Expression is of type "int" so it can't be of type "String". -- cgit v1.2.3