feat: updated engine

This commit is contained in:
Sara Gerretsen 2026-07-10 17:04:34 +02:00
parent cbe99774ff
commit f4cf6b3999
6607 changed files with 910135 additions and 430025 deletions

View file

@ -39,18 +39,18 @@
#include "core/config/project_settings.h"
#include "core/core_globals.h"
#include "core/io/dir_access.h"
#include "core/io/file_access_pack.h"
#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_uid.h"
#include "core/object/class_db.h"
#include "core/os/os.h"
#include "core/string/string_builder.h"
#include "scene/resources/packed_scene.h"
#include "tests/test_macros.h"
namespace GDScriptTests {
void init_autoloads() {
HashMap<StringName, ProjectSettings::AutoloadInfo> autoloads = ProjectSettings::get_singleton()->get_autoload_list();
// First pass, add the constants so they exist before any script is loaded.
for (const KeyValue<StringName, ProjectSettings::AutoloadInfo> &E : ProjectSettings::get_singleton()->get_autoload_list()) {
const ProjectSettings::AutoloadInfo &info = E.value;
@ -573,9 +573,21 @@ GDScriptTest::TestResult GDScriptTest::execute_test_code(bool p_is_generating) {
result.status = GDTEST_ANALYZER_ERROR;
result.output = get_text_for_status(result.status) + "\n";
// Errors are stored in the order they were added, which may not match the source code.
// Here we sort only by lines, preserving the original order for columns.
// So, within a single line, the primary error is printed first, not cascading ones.
struct SortErrors {
_FORCE_INLINE_ bool operator()(const GDScriptParser::ParserError &p_a, const GDScriptParser::ParserError &p_b) const {
return p_a.start_line < p_b.start_line;
}
};
List<GDScriptParser::ParserError> errors = List<GDScriptParser::ParserError>(parser.get_errors());
errors.sort_custom<SortErrors>();
StringBuilder error_string;
for (const GDScriptParser::ParserError &error : parser.get_errors()) {
error_string.append(vformat(">> ERROR at line %d: %s\n", error.line, error.message));
for (const GDScriptParser::ParserError &error : errors) {
error_string.append(vformat(">> ERROR at line %d: %s\n", error.start_line, error.message));
}
result.output += error_string.as_string();
if (!p_is_generating) {

View file

@ -30,10 +30,9 @@
#pragma once
#include "../gdscript.h"
#include "core/error/error_macros.h"
#include "core/string/print_string.h"
#include "core/string/string_name.h"
#include "core/string/ustring.h"
#include "core/templates/vector.h"

View file

@ -30,12 +30,18 @@
#pragma once
#include "../gdscript_cache.h"
#include "gdscript_test_runner.h"
#include "modules/gdscript/gdscript_cache.h"
#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
#include "tests/test_macros.h"
#include "tests/test_utils.h"
#ifdef TOOLS_ENABLED
#include "core/os/os.h"
#endif
namespace GDScriptTests {
class TestGDScriptCacheAccessor {
@ -86,6 +92,7 @@ func _init():
}
TEST_CASE("[Modules][GDScript] Loading keeps ResourceCache and GDScriptCache in sync") {
GDScriptLanguage::get_singleton()->init();
const String path = TestUtils::get_temp_path("gdscript_load_test.gd");
{

View file

@ -1,5 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 9: Native class "InstancePlaceholder" cannot be constructed as it is abstract.
>> ERROR at line 9: Name "new" is a Callable. You can call it with "new.call()" instead.
>> ERROR at line 10: Class "abstract_class_instantiate.gd::B" cannot be constructed as it is based on abstract native class "InstancePlaceholder".
>> ERROR at line 10: Name "new" is a Callable. You can call it with "new.call()" instead.

View file

@ -1,13 +1,13 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 37: "@abstract" annotation can only be used once per class.
>> ERROR at line 28: "@abstract" annotation can only be used once per function.
>> ERROR at line 35: "@abstract" annotation cannot be applied to static functions.
>> ERROR at line 40: A lambda function must have a ":" followed by a body.
>> ERROR at line 41: A lambda function must have a ":" followed by a body.
>> ERROR at line 11: Class "Test1" is not abstract but contains abstract methods. Mark the class as "@abstract" or remove "@abstract" from all methods in this class.
>> ERROR at line 14: Class "Test2" must implement "AbstractClass.some_func()" and other inherited abstract methods or be marked as "@abstract".
>> ERROR at line 17: Class "Test3" must implement "AbstractClassAgain.some_func()" and other inherited abstract methods or be marked as "@abstract".
>> ERROR at line 22: Cannot call the parent class' abstract function "some_func()" because it hasn't been defined.
>> ERROR at line 25: Cannot call the parent class' abstract function "some_func()" because it hasn't been defined.
>> ERROR at line 28: "@abstract" annotation can only be used once per function.
>> ERROR at line 32: An abstract function cannot have a body.
>> ERROR at line 35: "@abstract" annotation cannot be applied to static functions.
>> ERROR at line 35: A function must either have a ":" followed by a body, or be marked as "@abstract".
>> ERROR at line 37: "@abstract" annotation can only be used once per class.
>> ERROR at line 40: A lambda function must have a ":" followed by a body.
>> ERROR at line 41: A lambda function must have a ":" followed by a body.

View file

@ -0,0 +1,14 @@
enum { VALUE }
enum NamedEnum { VALUE }
const CONST = 0
signal signal_1
signal signal_2
func test():
VALUE = 1
NamedEnum = {}
NamedEnum.VALUE = 1
CONST = 1
signal_1 = signal_2

View file

@ -0,0 +1,6 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 10: Cannot assign a new value to a constant.
>> ERROR at line 11: Cannot assign a new value to a constant.
>> ERROR at line 12: Cannot assign a new value to a constant.
>> ERROR at line 13: Cannot assign a new value to a constant.
>> ERROR at line 14: Cannot assign a new value to a constant.

View file

@ -1,3 +0,0 @@
enum { V }
func test():
V = 1

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 3: Cannot assign a new value to a constant.

View file

@ -1,3 +0,0 @@
enum NamedEnum { V }
func test():
NamedEnum.V = 1

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 3: Cannot assign a new value to a constant.

View file

@ -1,4 +0,0 @@
signal your_base
signal my_base
func test():
your_base = my_base

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 4: Cannot assign a new value to a constant.

View file

@ -1,4 +1,10 @@
func test():
# Directly.
var tree := SceneTree.new()
tree.root = Window.new()
tree.free()
# Indirectly.
var state := PhysicsDirectBodyState3DExtension.new()
state.center_of_mass.x += 1.0
state.free()

View file

@ -1,2 +1,3 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 3: Cannot assign a new value to a read-only property.
>> ERROR at line 4: Cannot assign a new value to a read-only property.
>> ERROR at line 9: Cannot assign a new value to a read-only property.

View file

@ -1,4 +0,0 @@
func test():
var state := PhysicsDirectBodyState3DExtension.new()
state.center_of_mass.x += 1.0
state.free()

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 3: Cannot assign a new value to a read-only property.

View file

@ -1,2 +1,3 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 2: Invalid operands to operator <<, float and int.
>> ERROR at line 3: Invalid operands to operator >>, int and float.

View file

@ -1,3 +0,0 @@
func test():
# Error here.
print(2.2 << 4)

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 3: Invalid operands to operator <<, float and int.

View file

@ -1,3 +0,0 @@
func test():
var integer := 1
print(integer as Array)

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 3: Invalid cast. Cannot convert from "int" to "Array".

View file

@ -1,3 +0,0 @@
func test():
var integer := 1
print(integer as Node)

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 3: Invalid cast. Cannot convert from "int" to "Node".

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 3: Invalid cast. Cannot convert from "RefCounted" to "int".

View file

@ -1,5 +0,0 @@
class Vector2:
pass
func test():
pass

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 1: Class "Vector2" hides a built-in type.

View file

@ -0,0 +1,20 @@
# GH-118877
class Test1:
func _get_property_list() -> Array[int]:
return []
class Test2:
func _get_property_list() -> int:
return 0
class Test3:
func _get_property_list() -> void:
pass
class Test4:
func _get_property_list():
return 0
func test():
pass

View file

@ -0,0 +1,6 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 4: The function signature doesn't match the parent. Parent signature is "_get_property_list() -> Array[Dictionary]".
>> ERROR at line 8: The function signature doesn't match the parent. Parent signature is "_get_property_list() -> Array[Dictionary]".
>> ERROR at line 12: The function signature doesn't match the parent. Parent signature is "_get_property_list() -> Array[Dictionary]".
>> ERROR at line 17: Cannot return a value of type "int" as "Array".
>> ERROR at line 17: Cannot return value of type "int" because the function return type is "Array".

View file

@ -0,0 +1,10 @@
func test():
# GH-89357
print(Color(""))
print(Color("invalid"))
# GH-120049
print(char(-1))
print(char(0)) # The NUL character is not currently supported.
print(char(0xD800))
print(char(0x110000))

View file

@ -0,0 +1,7 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 3: Invalid color code "".
>> ERROR at line 4: Invalid color code "invalid".
>> ERROR at line 7: Invalid argument for "char()" function: -1 is not a valid character code.
>> ERROR at line 8: Invalid argument for "char()" function: 0 is not a valid character code.
>> ERROR at line 9: Invalid argument for "char()" function: 55296 is not a valid character code.
>> ERROR at line 10: Invalid argument for "char()" function: 1114112 is not a valid character code.

View file

@ -1,5 +0,0 @@
const array: Array = [0]
func test():
var key: int = 0
array[key] = 0

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Cannot assign a new value to a constant.

View file

@ -0,0 +1,7 @@
const ARRAY: Array = [0]
const DICTIONARY: Dictionary = { 0: 0 }
func test():
var key: int = 0
ARRAY[key] = 0
DICTIONARY[key] = 0

View file

@ -1,2 +1,3 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 6: Cannot assign a new value to a constant.
>> ERROR at line 7: Cannot assign a new value to a constant.

View file

@ -1,5 +0,0 @@
const dictionary := {}
func test():
var key: int = 0
dictionary[key] = 0

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Cannot assign a new value to a constant.

View file

@ -1,4 +0,0 @@
const Vector2 = 0
func test():
pass

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 1: The member "Vector2" cannot have the same name as a builtin type.

View file

@ -1,5 +0,0 @@
const CONSTANT = 25
func test():
CONSTANT(123)

View file

@ -1,3 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Member "CONSTANT" is not a function.
>> ERROR at line 5: Name "CONSTANT" called as a function but is a "int".

View file

@ -1,8 +0,0 @@
func test():
print(InnerA.new())
class InnerA extends InnerB:
pass
class InnerB extends InnerA:
pass

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 4: Cyclic inheritance.

View file

@ -1,5 +0,0 @@
func test():
print(c1)
const c1 = c2
const c2 = c1

View file

@ -1,3 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Could not resolve member "c1": Cyclic reference.
>> ERROR at line 5: Could not resolve type for constant "c2".

View file

@ -1,5 +0,0 @@
func test():
print(E1.V)
enum E1 {V = E2.V}
enum E2 {V = E1.V}

View file

@ -1,3 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Could not resolve member "E1": Cyclic reference.
>> ERROR at line 5: Enum values must be constant.

View file

@ -1,5 +0,0 @@
func test():
print(EV1)
enum {EV1 = EV2}
enum {EV2 = EV1}

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Could not resolve member "EV1": Cyclic reference.

View file

@ -1,6 +0,0 @@
func test():
print(v)
var v = A.v
const A = preload("cyclic_ref_external_a.notest.gd")

View file

@ -1,3 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 4: Could not resolve external class member "v".
>> ERROR at line 4: Cannot find member "v" in base "TestCyclicRefExternalA".

View file

@ -1,5 +0,0 @@
class_name TestCyclicRefExternalA
const B = preload("cyclic_ref_external.gd")
var v = B.v

View file

@ -1,9 +0,0 @@
func test():
print(f1())
print(f2())
static func f1(p := f2()) -> int:
return 1
static func f2(p := f1()) -> int:
return 2

View file

@ -1,3 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 8: Could not resolve member "f1": Cyclic reference.
>> ERROR at line 8: Cannot infer the type of "p" parameter because the value doesn't have a set type.

View file

@ -1,12 +0,0 @@
func test():
print(v)
var v := InnerA.new().f()
class InnerA:
func f(p := InnerB.new().f()) -> int:
return 1
class InnerB extends InnerA:
func f(p := 1) -> int:
return super.f()

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 11: Could not resolve member "f": Cyclic reference.

View file

@ -1,5 +0,0 @@
func test():
print(v1)
var v1 := v2
var v2 := v1

View file

@ -1,3 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Could not resolve member "v1": Cyclic reference.
>> ERROR at line 5: Cannot infer the type of "v2" variable because the value doesn't have a set type.

View file

@ -1,4 +0,0 @@
var v1 = v1
func test():
print(v1)

View file

@ -1,3 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 1: Could not resolve member "v1": Cyclic reference.
>> ERROR at line 1: Could not resolve type for variable "v1".

View file

@ -0,0 +1,41 @@
enum NamedEnum0 { VALUE = NamedEnum0.VALUE }
enum NamedEnum1 { VALUE = NamedEnum2.VALUE }
enum NamedEnum2 { VALUE = NamedEnum1.VALUE }
enum { ENUM_VALUE_0 = ENUM_VALUE_0 }
enum { ENUM_VALUE_1 = ENUM_VALUE_2 }
enum { ENUM_VALUE_2 = ENUM_VALUE_1 }
const CONST_0 = CONST_0
const CONST_1 = CONST_2
const CONST_2 = CONST_1
var var_0 = var_0
var var_1 := var_2
var var_2 := var_1
static func func_0(p := func_0()) -> int:
return 0
static func func_1(p := func_2()) -> int:
return 1
static func func_2(p := func_1()) -> int:
return 2
var lambda_body = (func (_p): return 0).call(lambda_body_ref)
var lambda_body_ref = lambda_body
var lambda_param = func (_p = lambda_param_ref): return 0
var lambda_param_ref = lambda_param
const External = preload("cyclic_reference.notest.gd")
var member = External.member
class InnerA:
func f(p := InnerB.new().f()) -> int:
return 1
class InnerB extends InnerA:
func f(p := 1) -> int:
return super.f()
func test():
pass

View file

@ -0,0 +1,5 @@
class_name TestCyclicRefExternal
const External = preload("cyclic_reference.gd")
var member = External.member

View file

@ -0,0 +1,27 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 1: Could not resolve member "NamedEnum0": Cyclic reference.
>> ERROR at line 1: Enum values must be constant.
>> ERROR at line 3: Could not resolve member "NamedEnum1": Cyclic reference.
>> ERROR at line 3: Enum values must be constant.
>> ERROR at line 5: Cannot use another enum element before it was declared.
>> ERROR at line 5: Enum values must be constant.
>> ERROR at line 7: Could not resolve member "ENUM_VALUE_1": Cyclic reference.
>> ERROR at line 9: Could not resolve member "CONST_0": Cyclic reference.
>> ERROR at line 9: Could not resolve type for constant "CONST_0".
>> ERROR at line 11: Could not resolve member "CONST_1": Cyclic reference.
>> ERROR at line 11: Could not resolve type for constant "CONST_2".
>> ERROR at line 13: Could not resolve member "var_0": Cyclic reference.
>> ERROR at line 13: Could not resolve type for variable "var_0".
>> ERROR at line 15: Could not resolve member "var_1": Cyclic reference.
>> ERROR at line 15: Cannot infer the type of "var_2" variable because the value doesn't have a set type.
>> ERROR at line 17: Could not resolve member "func_0": Cyclic reference.
>> ERROR at line 17: Cannot infer the type of "p" parameter because the value doesn't have a set type.
>> ERROR at line 21: Could not resolve member "func_1": Cyclic reference.
>> ERROR at line 21: Cannot infer the type of "p" parameter because the value doesn't have a set type.
>> ERROR at line 25: Could not resolve member "lambda_body": Cyclic reference.
>> ERROR at line 25: Could not resolve type for variable "lambda_body_ref".
>> ERROR at line 28: Could not resolve member "lambda_param": Cyclic reference.
>> ERROR at line 28: Could not resolve type for variable "lambda_param_ref".
>> ERROR at line 31: Could not resolve external class member "member".
>> ERROR at line 31: Cannot find member "member" in base "TestCyclicRefExternal".
>> ERROR at line 37: Could not resolve member "f": Cyclic reference.

View file

@ -0,0 +1,16 @@
func test():
var lua_dict = {
a = 1,
b = 2,
a = 3, # Duplicate isn't allowed.
}
var lua_dict_with_string = {
a = 1,
b = 2,
"a" = 3, # Duplicate isn't allowed.
}
var python_dict = {
"a": 1,
"b": 2,
"a": 3, # Duplicate isn't allowed.
}

View file

@ -0,0 +1,4 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Key "a" was already used in this dictionary (at line 3).
>> ERROR at line 10: Key "a" was already used in this dictionary (at line 8).
>> ERROR at line 15: Key "a" was already used in this dictionary (at line 13).

View file

@ -1,6 +0,0 @@
func test():
var lua_dict = {
a = 1,
b = 2,
a = 3, # Duplicate isn't allowed.
}

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Key "a" was already used in this dictionary (at line 3).

View file

@ -1,6 +0,0 @@
func test():
var lua_dict_with_string = {
a = 1,
b = 2,
"a" = 3, # Duplicate isn't allowed.
}

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Key "a" was already used in this dictionary (at line 3).

View file

@ -1,6 +0,0 @@
func test():
var python_dict = {
"a": 1,
"b": 2,
"a": 3, # Duplicate isn't allowed.
}

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Key "a" was already used in this dictionary (at line 3).

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 2: Cannot construct native class "Time" because it is an engine singleton.

View file

@ -1,4 +0,0 @@
enum Enum {V1, V2}
func test():
Enum.clear()

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 4: Cannot call non-const Dictionary function "clear()" on enum "Enum".

View file

@ -1,4 +0,0 @@
enum Enum {V1, V2}
func test():
var bad = Enum.V3

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 4: Cannot find member "V3" in base "enum_bad_value.gd.Enum".

View file

@ -1,2 +0,0 @@
func test():
print(Vector3.Axis)

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 2: Type "Axis" in base "Vector3" cannot be used on its own.

View file

@ -1,10 +0,0 @@
enum MyEnum { ENUM_VALUE_1, ENUM_VALUE_2 }
enum MyOtherEnum { OTHER_ENUM_VALUE_1, OTHER_ENUM_VALUE_2 }
# Different enum types can't be assigned without casting.
var class_var: MyEnum = MyEnum.ENUM_VALUE_1
func test():
print(class_var)
class_var = MyOtherEnum.OTHER_ENUM_VALUE_2
print(class_var)

View file

@ -1,3 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 9: Cannot assign a value of type "enum_class_var_assign_with_wrong_enum_type.gd.MyOtherEnum" as "enum_class_var_assign_with_wrong_enum_type.gd.MyEnum".
>> ERROR at line 9: Value of type "enum_class_var_assign_with_wrong_enum_type.gd.MyOtherEnum" cannot be assigned to a variable of type "enum_class_var_assign_with_wrong_enum_type.gd.MyEnum".

View file

@ -1,8 +0,0 @@
enum MyEnum { ENUM_VALUE_1, ENUM_VALUE_2 }
enum MyOtherEnum { OTHER_ENUM_VALUE_1, OTHER_ENUM_VALUE_2 }
# Different enum types can't be assigned without casting.
var class_var: MyEnum = MyOtherEnum.OTHER_ENUM_VALUE_1
func test():
print(class_var)

View file

@ -1,3 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Cannot assign a value of type "enum_class_var_init_with_wrong_enum_type.gd.MyOtherEnum" as "enum_class_var_init_with_wrong_enum_type.gd.MyEnum".
>> ERROR at line 5: Cannot assign a value of type enum_class_var_init_with_wrong_enum_type.gd.MyOtherEnum to variable "class_var" with specified type enum_class_var_init_with_wrong_enum_type.gd.MyEnum.

View file

@ -0,0 +1,28 @@
enum BadEnum {
A = 0.0,
B = "hello",
}
enum CustomEnum { A, B }
func test():
print(Variant.Operator) # Global.
print(Vector3.Axis) # Built-in.
print(Node.ProcessMode) # Native.
print(Side.NOT_EXIST) # Global.
print(Vector3.Axis.NOT_EXIST) # Built-in.
print(TileSet.TileShape.NOT_EXIST) # Native.
print(CustomEnum.NOT_EXIST) # Custom.
print(Side.size()) # Global.
print(Vector3.Axis.size()) # Built-in.
print(TileSet.TileShape.size()) # Native.
Side.clear() # Global.
Vector3.Axis.clear() # Built-in.
TileSet.TileShape.clear() # Native.
CustomEnum.clear() # Custom.
var enum_type = CustomEnum
enum_type.clear()

View file

@ -0,0 +1,30 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 2: Enum values must be integers.
>> ERROR at line 3: Enum values must be integers.
>> ERROR at line 9: Type "Operator" in base "Variant" cannot be used on its own.
>> ERROR at line 10: Type "Axis" in base "Vector3" cannot be used on its own.
>> ERROR at line 11: Type "ProcessMode" in base "Node" cannot be used on its own.
>> ERROR at line 13: Cannot find member "NOT_EXIST" in base "Side".
>> ERROR at line 14: Cannot find member "NOT_EXIST" in base "Vector3.Axis".
>> ERROR at line 15: Cannot find member "NOT_EXIST" in base "TileSet.TileShape".
>> ERROR at line 16: Cannot find member "NOT_EXIST" in base "enum_declaration_and_usage.gd.CustomEnum".
>> ERROR at line 18: Global enum "Side" cannot be used on its own.
>> ERROR at line 18: The native enum "Side" does not behave like Dictionary and does not have methods of its own.
>> ERROR at line 18: Static function "size()" not found in base "Side".
>> ERROR at line 19: Type "Axis" in base "Vector3" cannot be used on its own.
>> ERROR at line 19: Native class Vector3.Axis used in script doesn't exist or isn't exposed.
>> ERROR at line 19: Static function "size()" not found in base "Variant".
>> ERROR at line 20: Type "TileShape" in base "TileSet" cannot be used on its own.
>> ERROR at line 20: Native class TileSet.TileShape used in script doesn't exist or isn't exposed.
>> ERROR at line 20: Static function "size()" not found in base "Variant".
>> ERROR at line 22: Global enum "Side" cannot be used on its own.
>> ERROR at line 22: The native enum "Side" does not behave like Dictionary and does not have methods of its own.
>> ERROR at line 22: Static function "clear()" not found in base "Side".
>> ERROR at line 23: Type "Axis" in base "Vector3" cannot be used on its own.
>> ERROR at line 23: Native class Vector3.Axis used in script doesn't exist or isn't exposed.
>> ERROR at line 23: Static function "clear()" not found in base "Variant".
>> ERROR at line 24: Type "TileShape" in base "TileSet" cannot be used on its own.
>> ERROR at line 24: Native class TileSet.TileShape used in script doesn't exist or isn't exposed.
>> ERROR at line 24: Static function "clear()" not found in base "Variant".
>> ERROR at line 25: Cannot call non-const Dictionary function "clear()" on enum "CustomEnum".
>> ERROR at line 28: Cannot call non-const Dictionary function "clear()" on enum "CustomEnum".

View file

@ -1,5 +0,0 @@
enum Enum {V1, V2}
func test():
var Enum2 = Enum
Enum2.clear()

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Cannot call non-const Dictionary function "clear()" on enum "Enum".

View file

@ -1,7 +0,0 @@
enum Size {
# Error here. Enum values must be integers.
S = 0.0,
}
func test():
pass

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 3: Enum values must be integers.

View file

@ -1,8 +0,0 @@
enum MyEnum { ENUM_VALUE_1, ENUM_VALUE_2 }
enum MyOtherEnum { OTHER_ENUM_VALUE_1, OTHER_ENUM_VALUE_2 }
func enum_func(e: MyEnum) -> void:
print(e)
func test():
enum_func(MyOtherEnum.OTHER_ENUM_VALUE_1)

View file

@ -1,3 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 8: Cannot pass a value of type "enum_function_parameter_wrong_type.gd.MyOtherEnum" as "enum_function_parameter_wrong_type.gd.MyEnum".
>> ERROR at line 8: Invalid argument for "enum_func()" function: argument 1 should be "enum_function_parameter_wrong_type.gd.MyEnum" but is "enum_function_parameter_wrong_type.gd.MyOtherEnum".

View file

@ -1,8 +0,0 @@
enum MyEnum { ENUM_VALUE_1, ENUM_VALUE_2 }
enum MyOtherEnum { OTHER_ENUM_VALUE_1, OTHER_ENUM_VALUE_2 }
func enum_func() -> MyEnum:
return MyOtherEnum.OTHER_ENUM_VALUE_1
func test():
print(enum_func())

View file

@ -1,3 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Cannot return a value of type "enum_function_return_wrong_type.gd.MyOtherEnum" as "enum_function_return_wrong_type.gd.MyEnum".
>> ERROR at line 5: Cannot return value of type "enum_function_return_wrong_type.gd.MyOtherEnum" because the function return type is "enum_function_return_wrong_type.gd.MyEnum".

View file

@ -1,2 +0,0 @@
func test():
print(Variant.Operator)

View file

@ -1,2 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 2: Type "Operator" in base "Variant" cannot be used on its own.

View file

@ -1,10 +0,0 @@
enum MyEnum { ENUM_VALUE_1, ENUM_VALUE_2 }
class InnerClass:
enum MyEnum { ENUM_VALUE_1, ENUM_VALUE_2 }
func test():
var local_var: MyEnum = MyEnum.ENUM_VALUE_1
print(local_var)
local_var = InnerClass.MyEnum.ENUM_VALUE_2
print(local_var)

View file

@ -1,3 +0,0 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 9: Cannot assign a value of type "enum_local_var_assign_outer_with_wrong_enum_type.gd::InnerClass.MyEnum" as "enum_local_var_assign_outer_with_wrong_enum_type.gd.MyEnum".
>> ERROR at line 9: Value of type "enum_local_var_assign_outer_with_wrong_enum_type.gd::InnerClass.MyEnum" cannot be assigned to a variable of type "enum_local_var_assign_outer_with_wrong_enum_type.gd.MyEnum".

Some files were not shown because too many files have changed in this diff Show more