initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled

This commit is contained in:
2025-09-16 20:46:46 -04:00
commit 9d30169a8d
13378 changed files with 7050105 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
# Some tests handle invalid syntax deliberately; exclude relevant attributes.
# See also the `file-format` section in `.pre-commit-config.yaml`.
[parser/features/mixed_indentation_on_blank_lines.gd]
trim_trailing_whitespace = false
[parser/warnings/empty_file_newline.norun.gd]
insert_final_newline = false
[parser/warnings/empty_file_newline_comment.norun.gd]
insert_final_newline = false

View File

@@ -0,0 +1,2 @@
# Ignore metadata if someone open this on Godot.
/.godot

View File

@@ -0,0 +1,10 @@
class A extends InstancePlaceholder:
func _init():
print('no')
class B extends A:
pass
func test():
InstancePlaceholder.new()
B.new()

View File

@@ -0,0 +1,5 @@
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

@@ -0,0 +1,44 @@
@abstract class AbstractClass:
@abstract func some_func()
class ImplementedClass extends AbstractClass:
func some_func():
pass
@abstract class AbstractClassAgain extends ImplementedClass:
@abstract func some_func()
class Test1:
@abstract func some_func()
class Test2 extends AbstractClass:
pass
class Test3 extends AbstractClassAgain:
pass
class Test4 extends AbstractClass:
func some_func():
super()
func other_func():
super.some_func()
@abstract class A:
@abstract @abstract func abstract_dup()
# An abstract function cannot have a body.
@abstract func abstract_bodyful():
pass
# A static function cannot be marked as `@abstract`.
@abstract static func abstract_stat()
@abstract @abstract class DuplicateAbstract:
pass
func holding_some_invalid_lambda(invalid_default_arg = func():):
var some_invalid_lambda = (func():)
func test():
pass

View File

@@ -0,0 +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 32: An abstract function cannot have a body.
>> ERROR at line 35: A function must either have a ":" followed by a body, or be marked as "@abstract".

View File

@@ -0,0 +1,6 @@
var num := 1
@export_range(num, 10) var a
func test():
pass

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 3: Argument 1 of annotation "@export_range" isn't a constant expression.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,4 @@
func test():
var tree := SceneTree.new()
tree.root = Window.new()
tree.free()

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,3 @@
func test():
var var_color: String = Color.RED
print('not ok')

View File

@@ -0,0 +1,3 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 2: Cannot assign a value of type "Color" as "String".
>> ERROR at line 2: Cannot assign a value of type Color to variable "var_color" with specified type String.

View File

@@ -0,0 +1,4 @@
signal my_signal()
func test():
var _a := await my_signal

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 4: Cannot infer the type of "_a" variable because the value doesn't have a set type.

View File

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

View File

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

View File

@@ -0,0 +1,3 @@
func test():
# Error here.
print(2 >> 4.4)

View File

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

View File

@@ -0,0 +1,7 @@
# GH-73283
class MyClass:
pass
func test():
MyClass.not_existing_method()

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 7: Static function "not_existing_method()" not found in base "MyClass".

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,3 @@
func test():
var object := RefCounted.new()
print(object as int)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,5 @@
const base := [0]
func test():
var sub := base[0]
if sub is String: pass

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 5: Expression is of type "int" so it can't be of type "String".

View File

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

View File

@@ -0,0 +1,3 @@
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

@@ -0,0 +1,10 @@
extends RefCounted
const AbstractScript = preload("./construct_abstract_script.notest.gd")
@abstract class AbstractClass:
pass
func test():
var _a := AbstractScript.new()
var _b := AbstractClass.new()

View File

@@ -0,0 +1,3 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 9: Cannot construct abstract class "AbstractScript".
>> ERROR at line 10: Cannot construct abstract class "AbstractClass".

View File

@@ -0,0 +1 @@
@abstract class_name AbstractScript

View File

@@ -0,0 +1,10 @@
class A:
func _init():
pass
class B extends A: pass
class C extends A: pass
func test():
var x := B.new()
print(x is C)

View File

@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
>> ERROR at line 10: Expression is of type "B" so it can't be of type "C".

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,3 @@
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

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

View File

@@ -0,0 +1,3 @@
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

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

View File

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

View File

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

View File

@@ -0,0 +1,3 @@
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

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

View File

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

View File

@@ -0,0 +1,3 @@
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

@@ -0,0 +1,12 @@
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

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

View File

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

View File

@@ -0,0 +1,3 @@
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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,9 @@
# https://github.com/godotengine/godot/issues/62957
func test():
var dict = {
&"key": "StringName",
"key": "String"
}
print("Invalid dictionary: %s" % dict)

View File

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

View File

@@ -0,0 +1,2 @@
func test():
Time.new()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,10 @@
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

@@ -0,0 +1,3 @@
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

@@ -0,0 +1,8 @@
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

@@ -0,0 +1,3 @@
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,5 @@
enum Enum {V1, V2}
func test():
var Enum2 = Enum
Enum2.clear()

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,8 @@
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

@@ -0,0 +1,3 @@
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

@@ -0,0 +1,8 @@
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

@@ -0,0 +1,3 @@
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

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

View File

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

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