feat: updated engine version to 4.4-rc1

This commit is contained in:
Sara 2025-02-23 14:38:14 +01:00
parent ee00efde1f
commit 21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions

View file

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

View file

@ -1,6 +0,0 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: assign()
>> runtime/assign_to_read_only_property.gd
>> 7
>> Cannot set value into property "center_of_mass" (on base "PhysicsDirectBodyState3DExtension") because it is read-only.

View file

@ -1,8 +0,0 @@
func test():
var state = PhysicsDirectBodyState3DExtension.new()
var prop = &"center_of_mass"
assign(state, prop)
state.free()
func assign(state, prop):
state[prop].x = 1.0

View file

@ -1,6 +0,0 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: assign()
>> runtime/assign_to_read_only_property_with_variable_index.gd
>> 8
>> Cannot set value into property "center_of_mass" (on base "PhysicsDirectBodyState3DExtension") because it is read-only.

View file

@ -0,0 +1,22 @@
class A extends Node:
pass
func subtest_native():
var x = Node.new()
x.free()
var _ok = x
var _bad: Node = x
func subtest_script():
var x = A.new()
x.free()
var _ok = x
var _bad: A = x
func test():
subtest_native()
subtest_script()

View file

@ -0,0 +1,3 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR at runtime/errors/assign_freed_instance.gd:10 on subtest_native(): Trying to assign invalid previously freed instance.
>> SCRIPT ERROR at runtime/errors/assign_freed_instance.gd:18 on subtest_script(): Trying to assign invalid previously freed instance.

View file

@ -0,0 +1,11 @@
func subtest_attribute(state):
state.center_of_mass.x -= 1.0
func subtest_variable_index(state, prop):
state[prop].x = 1.0
func test():
var state = PhysicsDirectBodyState3DExtension.new()
subtest_attribute(state)
subtest_variable_index(state, &"center_of_mass")
state.free()

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
~~ WARNING at line 9: (UNSAFE_CALL_ARGUMENT) The argument 1 of the function "subtest_attribute()" requires the subtype "Variant" but the supertype "Variant" was provided.
~~ WARNING at line 10: (UNSAFE_CALL_ARGUMENT) The argument 1 of the function "subtest_variable_index()" requires the subtype "Variant" but the supertype "Variant" was provided.
>> ERROR: Required virtual method PhysicsDirectBodyState3DExtension::_get_center_of_mass must be overridden before calling.
>> SCRIPT ERROR at runtime/errors/assign_to_read_only_property.gd:2 on subtest_attribute(): Cannot set value into property "center_of_mass" (on base "PhysicsDirectBodyState3DExtension") because it is read-only.
>> SCRIPT ERROR at runtime/errors/assign_to_read_only_property.gd:5 on subtest_variable_index(): Cannot set value into property "center_of_mass" (on base "PhysicsDirectBodyState3DExtension") because it is read-only.

View file

@ -1,8 +1,4 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: weak()
>> runtime/errors/bad_conversion_for_default_parameter.gd
>> 2
>> Trying to assign value of type 'String' to a variable of type 'float'.
>> SCRIPT ERROR at runtime/errors/bad_conversion_for_default_parameter.gd:2 on weak(): Trying to assign value of type 'String' to a variable of type 'float'.
0
not ok

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/callable_call_after_free_object.gd
>> 6
>> Attempt to call function 'null::is_inside_tree (Callable)' on a null instance.
>> SCRIPT ERROR at runtime/errors/callable_call_after_free_object.gd:6 on test(): Attempt to call function 'null::is_inside_tree (Callable)' on a null instance.

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/cast_freed_object.gd
>> 4
>> Trying to cast a freed object.
>> SCRIPT ERROR at runtime/errors/cast_freed_object.gd:4 on test(): Trying to cast a freed object.

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/cast_int_to_array.gd
>> 4
>> Invalid cast: could not convert value to 'Array'.
>> SCRIPT ERROR at runtime/errors/cast_int_to_array.gd:4 on test(): Invalid cast: could not convert value to 'Array'.

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/cast_int_to_object.gd
>> 4
>> Invalid cast: can't convert a non-object value to an object type.
>> SCRIPT ERROR at runtime/errors/cast_int_to_object.gd:4 on test(): Invalid cast: can't convert a non-object value to an object type.

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/cast_object_to_int.gd
>> 4
>> Invalid cast: could not convert value to 'int'.
>> SCRIPT ERROR at runtime/errors/cast_object_to_int.gd:4 on test(): Invalid cast: could not convert value to 'int'.

View file

@ -1,6 +1,4 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/constant_array_is_deep.gd
>> 6
>> Invalid assignment on read-only value (on base: 'Dictionary').
>> ERROR: Condition "_p->read_only" is true. Returning: false
>> Dictionary is in read-only state.
>> SCRIPT ERROR at runtime/errors/constant_array_is_deep.gd:6 on test(): Invalid assignment on read-only value (on base: 'Dictionary').

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/constant_dictionary_is_deep.gd
>> 6
>> Invalid assignment on read-only value (on base: 'Array').
>> SCRIPT ERROR at runtime/errors/constant_dictionary_is_deep.gd:6 on test(): Invalid assignment on read-only value (on base: 'Array').

View file

@ -0,0 +1,3 @@
func test():
var integer: int = 1
integer /= 0

View file

@ -0,0 +1,3 @@
GDTEST_RUNTIME_ERROR
~~ WARNING at line 2: (UNUSED_VARIABLE) The local variable "integer" is declared but never used in the block. If this is intended, prefix it with an underscore: "_integer".
>> SCRIPT ERROR at runtime/errors/division_by_zero.gd:3 on test(): Division by zero error in operator '/'.

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/for_loop_iterator_type_not_match_specified.gd
>> 3
>> Trying to assign value of type 'Resource' to a variable of type 'Node'.
>> SCRIPT ERROR at runtime/errors/for_loop_iterator_type_not_match_specified.gd:3 on test(): Trying to assign value of type 'Resource' to a variable of type 'Node'.

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/gd_utility_function_wrong_arg.gd
>> 3
>> Error calling GDScript utility function "len()": Value of type 'Color' can't provide a length.
>> SCRIPT ERROR at runtime/errors/gd_utility_function_wrong_arg.gd:3 on test(): Error calling GDScript utility function "len()": Value of type 'Color' can't provide a length.

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/invalid_property_assignment.gd
>> 9
>> Invalid assignment of property or key 'obj' with value of type 'RefCounted (MyObj)' on a base object of type 'RefCounted (MyObj)'.
>> SCRIPT ERROR at runtime/errors/invalid_property_assignment.gd:9 on test(): Invalid assignment of property or key 'obj' with value of type 'RefCounted (MyObj)' on a base object of type 'RefCounted (MyObj)'.

View file

@ -0,0 +1,3 @@
func test():
var integer: int = 1
integer %= 0

View file

@ -0,0 +1,3 @@
GDTEST_RUNTIME_ERROR
~~ WARNING at line 2: (UNUSED_VARIABLE) The local variable "integer" is declared but never used in the block. If this is intended, prefix it with an underscore: "_integer".
>> SCRIPT ERROR at runtime/errors/modulo_by_zero.gd:3 on test(): Modulo by zero error in operator '%'.

View file

@ -1,6 +1,3 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: example()
>> runtime/errors/non_static_method_call_on_native_class.gd
>> 6
>> Invalid call. Nonexistent function 'has_method' in base 'Node2D'.
~~ WARNING at line 6: (UNSAFE_METHOD_ACCESS) The method "has_method()" is not present on the inferred type "Variant" (but may be present on a subtype).
>> SCRIPT ERROR at runtime/errors/non_static_method_call_on_native_class.gd:6 on example(): Invalid call. Nonexistent function 'has_method' in base 'Node2D'.

View file

@ -0,0 +1,28 @@
class Outer:
const OUTER_CONST := 0
class Inner:
pass
func subtest_type_hard():
var type := Outer.Inner
print(type.OUTER_CONST)
func subtest_type_weak():
var type := Outer.Inner
var type_v: Variant = type
print(type_v.OUTER_CONST)
func subtest_instance_hard():
var instance := Outer.Inner.new()
print(instance.OUTER_CONST)
func subtest_instance_weak():
var instance := Outer.Inner.new()
var instance_v: Variant = instance
print(instance_v.OUTER_CONST)
func test():
subtest_type_hard()
subtest_type_weak()
subtest_instance_hard()
subtest_instance_weak()

View file

@ -0,0 +1,7 @@
GDTEST_RUNTIME_ERROR
~~ WARNING at line 8: (UNSAFE_PROPERTY_ACCESS) The property "OUTER_CONST" is not present on the inferred type "Inner" (but may be present on a subtype).
~~ WARNING at line 17: (UNSAFE_PROPERTY_ACCESS) The property "OUTER_CONST" is not present on the inferred type "Inner" (but may be present on a subtype).
>> SCRIPT ERROR at runtime/errors/outer_class_constants.gd:8 on subtest_type_hard(): Invalid access to property or key 'OUTER_CONST' on a base object of type 'GDScript'.
>> SCRIPT ERROR at runtime/errors/outer_class_constants.gd:13 on subtest_type_weak(): Invalid access to property or key 'OUTER_CONST' on a base object of type 'GDScript'.
>> SCRIPT ERROR at runtime/errors/outer_class_constants.gd:17 on subtest_instance_hard(): Invalid access to property or key 'OUTER_CONST' on a base object of type 'RefCounted (Inner)'.
>> SCRIPT ERROR at runtime/errors/outer_class_constants.gd:22 on subtest_instance_weak(): Invalid access to property or key 'OUTER_CONST' on a base object of type 'RefCounted (Inner)'.

View file

@ -1,6 +1,4 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/read_only_dictionary.gd
>> 4
>> Invalid assignment on read-only value (on base: 'Dictionary').
>> ERROR: Condition "_p->read_only" is true. Returning: false
>> Dictionary is in read-only state.
>> SCRIPT ERROR at runtime/errors/read_only_dictionary.gd:4 on test(): Invalid assignment on read-only value (on base: 'Dictionary').

View file

@ -1,4 +1,4 @@
func test():
var basic := [1]
var typed: Array[int] = basic
var _typed: Array[int] = basic
print('not ok')

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/typed_array_assign_basic_to_typed.gd
>> 3
>> Trying to assign an array of type "Array" to a variable of type "Array[int]".
>> SCRIPT ERROR at runtime/errors/typed_array_assign_basic_to_typed.gd:3 on test(): Trying to assign an array of type "Array" to a variable of type "Array[int]".

View file

@ -1,4 +1,4 @@
func test():
var differently: Variant = [1.0] as Array[float]
var typed: Array[int] = differently
var _typed: Array[int] = differently
print('not ok')

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/typed_array_assign_differently_typed.gd
>> 3
>> Trying to assign an array of type "Array[float]" to a variable of type "Array[int]".
>> SCRIPT ERROR at runtime/errors/typed_array_assign_differently_typed.gd:3 on test(): Trying to assign an array of type "Array[float]" to a variable of type "Array[int]".

View file

@ -3,5 +3,5 @@ class Bar extends Foo: pass
class Baz extends Foo: pass
func test():
var typed: Array[Bar] = [Baz.new() as Foo]
var _typed: Array[Bar] = [Baz.new() as Foo]
print('not ok')

View file

@ -1,5 +1,6 @@
GDTEST_RUNTIME_ERROR
>> ERROR
>> Method/function failed.
>> Unable to convert array index 0 from "Object" to "Object".
>> ERROR: Condition "!other_script->inherits_script(script)" is true. Returning: false
>> Attempted to assign an object into a TypedArray, that does not inherit from 'GDScript'.
>> ERROR: Method/function failed.
>> Unable to convert array index 0 from "Object" to "Object".
not ok

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/typed_array_pass_basic_to_typed.gd
>> 6
>> Invalid type in function 'expect_typed' in base 'RefCounted (typed_array_pass_basic_to_typed.gd)'. The array of argument 1 (Array) does not have the same element type as the expected typed array argument.
>> SCRIPT ERROR at runtime/errors/typed_array_pass_basic_to_typed.gd:6 on test(): Invalid type in function 'expect_typed' in base 'RefCounted (typed_array_pass_basic_to_typed.gd)'. The array of argument 1 (Array) does not have the same element type as the expected typed array argument.

View file

@ -1,6 +1,3 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/typed_array_pass_differently_to_typed.gd
>> 6
>> Invalid type in function 'expect_typed' in base 'RefCounted (typed_array_pass_differently_to_typed.gd)'. The array of argument 1 (Array[float]) does not have the same element type as the expected typed array argument.
~~ WARNING at line 6: (UNSAFE_CALL_ARGUMENT) The argument 1 of the function "expect_typed()" requires the subtype "Array[int]" but the supertype "Variant" was provided.
>> SCRIPT ERROR at runtime/errors/typed_array_pass_differently_to_typed.gd:6 on test(): Invalid type in function 'expect_typed' in base 'RefCounted (typed_array_pass_differently_to_typed.gd)'. The array of argument 1 (Array[float]) does not have the same element type as the expected typed array argument.

View file

@ -0,0 +1,4 @@
func test():
var basic := { 1: 1 }
var _typed: Dictionary[int, int] = basic
print('not ok')

View file

@ -0,0 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR at runtime/errors/typed_dictionary_assign_basic_to_typed.gd:3 on test(): Trying to assign a dictionary of type "Dictionary" to a variable of type "Dictionary[int, int]".

View file

@ -0,0 +1,4 @@
func test():
var differently: Variant = { 1.0: 0.0 } as Dictionary[float, float]
var _typed: Dictionary[int, int] = differently
print('not ok')

View file

@ -0,0 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR at runtime/errors/typed_dictionary_assign_differently_typed.gd:3 on test(): Trying to assign a dictionary of type "Dictionary[float, float]" to a variable of type "Dictionary[int, int]".

View file

@ -0,0 +1,7 @@
func get_key() -> Variant:
return "key"
func test():
var typed: Dictionary[int, int]
typed[get_key()] = 0
print('not ok')

View file

@ -0,0 +1,5 @@
GDTEST_RUNTIME_ERROR
>> ERROR: Method/function failed. Returning: false
>> Attempted to set a variable of type 'String' into a TypedDictionary.Key of type 'int'.
>> ERROR: Condition "!_p->typed_key.validate(key, "set")" is true. Returning: false
>> SCRIPT ERROR at runtime/errors/typed_dictionary_assign_differently_typed_key.gd:6 on test(): Invalid assignment of property or key 'key' with value of type 'int' on a base object of type 'Dictionary[int, int]'.

View file

@ -0,0 +1,7 @@
func get_value() -> Variant:
return "value"
func test():
var typed: Dictionary[int, int]
typed[0] = get_value()
print("not ok")

View file

@ -0,0 +1,5 @@
GDTEST_RUNTIME_ERROR
>> ERROR: Method/function failed. Returning: false
>> Attempted to set a variable of type 'String' into a TypedDictionary.Value of type 'int'.
>> ERROR: Condition "!_p->typed_value.validate(value, "set")" is true. Returning: false
>> SCRIPT ERROR at runtime/errors/typed_dictionary_assign_differently_typed_value.gd:6 on test(): Invalid assignment of property or key '0' with value of type 'String' on a base object of type 'Dictionary[int, int]'.

View file

@ -0,0 +1,7 @@
class Foo: pass
class Bar extends Foo: pass
class Baz extends Foo: pass
func test():
var _typed: Dictionary[Bar, Bar] = { Baz.new() as Foo: Baz.new() as Foo }
print('not ok')

View file

@ -0,0 +1,6 @@
GDTEST_RUNTIME_ERROR
>> ERROR: Condition "!other_script->inherits_script(script)" is true. Returning: false
>> Attempted to assign an object into a TypedDictionary.Key, that does not inherit from 'GDScript'.
>> ERROR: Method/function failed.
>> Unable to convert key from "Object" to "Object".
not ok

View file

@ -0,0 +1,7 @@
func expect_typed(typed: Dictionary[int, int]):
print(typed.size())
func test():
var basic := { 1: 1 }
expect_typed(basic)
print('not ok')

View file

@ -0,0 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR at runtime/errors/typed_dictionary_pass_basic_to_typed.gd:6 on test(): Invalid type in function 'expect_typed' in base 'RefCounted (typed_dictionary_pass_basic_to_typed.gd)'. The dictionary of argument 1 (Dictionary) does not have the same element type as the expected typed dictionary argument.

View file

@ -0,0 +1,7 @@
func expect_typed(typed: Dictionary[int, int]):
print(typed.size())
func test():
var differently: Variant = { 1.0: 0.0 } as Dictionary[float, float]
expect_typed(differently)
print('not ok')

View file

@ -0,0 +1,3 @@
GDTEST_RUNTIME_ERROR
~~ WARNING at line 6: (UNSAFE_CALL_ARGUMENT) The argument 1 of the function "expect_typed()" requires the subtype "Dictionary[int, int]" but the supertype "Variant" was provided.
>> SCRIPT ERROR at runtime/errors/typed_dictionary_pass_differently_to_typed.gd:6 on test(): Invalid type in function 'expect_typed' in base 'RefCounted (typed_dictionary_pass_differently_to_typed.gd)'. The dictionary of argument 1 (Dictionary[float, float]) does not have the same element type as the expected typed dictionary argument.

View file

@ -1,6 +1,3 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/use_return_value_of_free_call.gd
>> 4
>> Trying to get a return value of a method that returns "void"
~~ WARNING at line 4: (UNSAFE_METHOD_ACCESS) The method "free()" is not present on the inferred type "Variant" (but may be present on a subtype).
>> SCRIPT ERROR at runtime/errors/use_return_value_of_free_call.gd:4 on test(): Trying to get a return value of a method that returns "void"

View file

@ -1,6 +1,3 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/use_return_value_of_void_builtin_method_call.gd
>> 4
>> Trying to get a return value of a method that returns "void"
~~ WARNING at line 4: (UNSAFE_METHOD_ACCESS) The method "reverse()" is not present on the inferred type "Variant" (but may be present on a subtype).
>> SCRIPT ERROR at runtime/errors/use_return_value_of_void_builtin_method_call.gd:4 on test(): Trying to get a return value of a method that returns "void"

View file

@ -1,6 +1,3 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/use_return_value_of_void_native_method_call.gd
>> 4
>> Trying to get a return value of a method that returns "void"
~~ WARNING at line 4: (UNSAFE_METHOD_ACCESS) The method "notify_property_list_changed()" is not present on the inferred type "Variant" (but may be present on a subtype).
>> SCRIPT ERROR at runtime/errors/use_return_value_of_void_native_method_call.gd:4 on test(): Trying to get a return value of a method that returns "void"

View file

@ -1,6 +1,2 @@
GDTEST_RUNTIME_ERROR
>> SCRIPT ERROR
>> on function: test()
>> runtime/errors/utility_function_wrong_arg.gd
>> 3
>> Error calling utility function "floor()": Argument "x" must be "int", "float", "Vector2", "Vector2i", "Vector3", "Vector3i", "Vector4", or "Vector4i".
>> SCRIPT ERROR at runtime/errors/utility_function_wrong_arg.gd:3 on test(): Error calling utility function "floor()": Argument "x" must be "int", "float", "Vector2", "Vector2i", "Vector3", "Vector3i", "Vector4", or "Vector4i".

View file

@ -25,7 +25,7 @@ func test():
print("String in Array[StringName]: ", "abc" in stringname_array)
var packed_string_array: PackedStringArray = []
assert(!packed_string_array.push_back("abc"))
Utils.check(!packed_string_array.push_back("abc"))
print("StringName in PackedStringArray: ", &"abc" in packed_string_array)
string_array.push_back("abc")

View file

@ -1,6 +1,6 @@
# https://github.com/godotengine/godot/issues/75832
@warning_ignore("narrowing_conversion")
@warning_ignore_start("narrowing_conversion")
func test():
var hf := 2.0
var sf = 2.0

View file

@ -1,6 +1,3 @@
GDTEST_OK
>> WARNING
>> Line: 4
>> REDUNDANT_AWAIT
>> "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal.
~~ WARNING at line 4: (REDUNDANT_AWAIT) "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal.
awaited

View file

@ -1,7 +1,7 @@
GDTEST_OK
{ 1: (2, 0) }
{ 3: (4, 0) }
[[(5, 0)]]
[[(6, 0)]]
[[(7, 0)]]
[X: (8, 9, 7), Y: (0, 1, 0), Z: (0, 0, 1), O: (0, 0, 0)]
{ 1: (2.0, 0.0) }
{ 3: (4.0, 0.0) }
[[(5.0, 0.0)]]
[[(6.0, 0.0)]]
[[(7.0, 0.0)]]
[X: (8.0, 9.0, 7.0), Y: (0.0, 1.0, 0.0), Z: (0.0, 0.0, 1.0), O: (0.0, 0.0, 0.0)]

View file

@ -1,10 +1,9 @@
const array: Array = [0]
const dictionary := {1: 2}
@warning_ignore("assert_always_true")
func test():
assert(array.is_read_only() == true)
assert(str(array) == '[0]')
assert(dictionary.is_read_only() == true)
assert(str(dictionary) == '{ 1: 2 }')
Utils.check(array.is_read_only() == true)
Utils.check(str(array) == '[0]')
Utils.check(dictionary.is_read_only() == true)
Utils.check(str(dictionary) == '{ 1: 2 }')
print('ok')

View file

@ -1,8 +1,8 @@
GDTEST_OK
x is 1
x is 1.0
typeof x is 3
x is 2
x is 2.0
typeof x is 3
x is 3
x is 3.0
typeof x is 3
ok

View file

@ -2,8 +2,8 @@ class Foo extends Node:
func _init():
name = 'f'
var string: String = name
assert(typeof(string) == TYPE_STRING)
assert(string == 'f')
Utils.check(typeof(string) == TYPE_STRING)
Utils.check(string == 'f')
print('ok')
func test():

View file

@ -6,15 +6,15 @@ extends Node
@onready var later_untyped = [1]
func test():
assert(typeof(later_inferred) == TYPE_ARRAY)
assert(later_inferred.size() == 0)
Utils.check(typeof(later_inferred) == TYPE_ARRAY)
Utils.check(later_inferred.size() == 0)
assert(typeof(later_static) == TYPE_ARRAY)
assert(later_static.size() == 0)
Utils.check(typeof(later_static) == TYPE_ARRAY)
Utils.check(later_static.size() == 0)
assert(typeof(later_static_with_init) == TYPE_ARRAY)
assert(later_static_with_init.size() == 0)
Utils.check(typeof(later_static_with_init) == TYPE_ARRAY)
Utils.check(later_static_with_init.size() == 0)
assert(typeof(later_untyped) == TYPE_NIL)
Utils.check(typeof(later_untyped) == TYPE_NIL)
print("ok")

View file

@ -7,11 +7,11 @@ func test():
stringname_dict[&"abc"] = 24
print("String key is TYPE_STRING: ", typeof(string_dict.keys()[0]) == TYPE_STRING)
print("StringName key is TYPE_STRING: ", typeof(stringname_dict.keys()[0]) == TYPE_STRING)
print("StringName key is TYPE_STRING_NAME: ", typeof(stringname_dict.keys()[0]) == TYPE_STRING_NAME)
print("StringName gets String: ", string_dict.get(&"abc"))
print("String gets StringName: ", stringname_dict.get("abc"))
stringname_dict[&"abc"] = 42
# They compare equal because StringName keys are converted to String.
# They compare equal because StringName keys are considered equivalent to String keys.
print("String Dictionary == StringName Dictionary: ", string_dict == stringname_dict)

View file

@ -1,6 +1,6 @@
GDTEST_OK
String key is TYPE_STRING: true
StringName key is TYPE_STRING: true
StringName key is TYPE_STRING_NAME: true
StringName gets String: 42
String gets StringName: 24
String Dictionary == StringName Dictionary: true

View file

@ -1,5 +1,3 @@
const Utils = preload("../../utils.notest.gd")
# GH-73843
@export_group("Resource")

View file

@ -28,13 +28,18 @@ func test():
prints(var_to_str(e), var_to_str(elem))
print("Test String-keys dictionary.")
var d1 := {a = 1, b = 2, c = 3}
var d1 := { a = 1, b = 2, c = 3 }
for k: StringName in d1:
var key := k
prints(var_to_str(k), var_to_str(key))
print("Test RefCounted-keys dictionary.")
var d2 := {RefCounted.new(): 1, Resource.new(): 2, ConfigFile.new(): 3}
var d2 := { RefCounted.new(): 1, Resource.new(): 2, ConfigFile.new(): 3 }
for k: RefCounted in d2:
var key := k
prints(k.get_class(), key.get_class())
print("Test implicitly typed dictionary literal.")
for k: StringName in { x = 123, y = 456, z = 789 }:
var key := k
prints(var_to_str(k), var_to_str(key))

View file

@ -27,3 +27,7 @@ Test RefCounted-keys dictionary.
RefCounted RefCounted
Resource Resource
ConfigFile ConfigFile
Test implicitly typed dictionary literal.
&"x" &"x"
&"y" &"y"
&"z" &"z"

View file

@ -0,0 +1,12 @@
func test():
const COLOR = Color8(255, 0.0, false)
var false_value := false
@warning_ignore("narrowing_conversion")
var color = Color8(255, 0.0, false_value)
print(var_to_str(COLOR))
print(var_to_str(color))
var string := "Node"
var string_name := &"Node"
print(type_exists(string))
print(type_exists(string_name))

View file

@ -0,0 +1,5 @@
GDTEST_OK
Color(1, 0, 0, 1)
Color(1, 0, 0, 1)
true
true

View file

@ -62,7 +62,7 @@ func test():
0 when side_effect():
print("will run the side effect call, but not this")
_:
assert(global == 1)
Utils.check(global == 1)
print("side effect only ran once")
func side_effect():

View file

@ -5,8 +5,6 @@ class MyClass:
enum MyEnum {}
const Utils = preload("../../utils.notest.gd")
static var test_static_var_untyped
static var test_static_var_weak_null = null
static var test_static_var_weak_int = 1
@ -33,6 +31,16 @@ var test_var_hard_array_my_enum: Array[MyEnum]
var test_var_hard_array_resource: Array[Resource]
var test_var_hard_array_this: Array[TestMemberInfo]
var test_var_hard_array_my_class: Array[MyClass]
var test_var_hard_dictionary: Dictionary
var test_var_hard_dictionary_int_variant: Dictionary[int, Variant]
var test_var_hard_dictionary_variant_int: Dictionary[Variant, int]
var test_var_hard_dictionary_int_int: Dictionary[int, int]
var test_var_hard_dictionary_variant_type: Dictionary[Variant.Type, Variant.Type]
var test_var_hard_dictionary_node_process_mode: Dictionary[Node.ProcessMode, Node.ProcessMode]
var test_var_hard_dictionary_my_enum: Dictionary[MyEnum, MyEnum]
var test_var_hard_dictionary_resource: Dictionary[Resource, Resource]
var test_var_hard_dictionary_this: Dictionary[TestMemberInfo, TestMemberInfo]
var test_var_hard_dictionary_my_class: Dictionary[MyClass, MyClass]
var test_var_hard_resource: Resource
var test_var_hard_this: TestMemberInfo
var test_var_hard_my_class: MyClass
@ -45,27 +53,19 @@ func test_func_weak_null(): return null
func test_func_weak_int(): return 1
func test_func_hard_variant() -> Variant: return null
func test_func_hard_int() -> int: return 1
func test_func_args_1(_a: int, _b: Array[int], _c: int = 1, _d = 2): pass
func test_func_args_1(_a: int, _b: Array[int], _c: Dictionary[int, int], _d: int = 1, _e = 2): pass
func test_func_args_2(_a = 1, _b = _a, _c = [2], _d = 3): pass
@warning_ignore_start("unused_signal")
signal test_signal_1()
signal test_signal_2(a: Variant, b)
signal test_signal_3(a: int, b: Array[int])
signal test_signal_4(a: Variant.Type, b: Array[Variant.Type])
signal test_signal_5(a: MyEnum, b: Array[MyEnum])
signal test_signal_6(a: Resource, b: Array[Resource])
signal test_signal_7(a: TestMemberInfo, b: Array[TestMemberInfo])
signal test_signal_8(a: MyClass, b: Array[MyClass])
func no_exec():
test_signal_1.emit()
test_signal_2.emit()
test_signal_3.emit()
test_signal_4.emit()
test_signal_5.emit()
test_signal_6.emit()
test_signal_7.emit()
test_signal_8.emit()
signal test_signal_3(a: int, b: Array[int], c: Dictionary[int, int])
signal test_signal_4(a: Variant.Type, b: Array[Variant.Type], c: Dictionary[Variant.Type, Variant.Type])
signal test_signal_5(a: MyEnum, b: Array[MyEnum], c: Dictionary[MyEnum, MyEnum])
signal test_signal_6(a: Resource, b: Array[Resource], c: Dictionary[Resource, Resource])
signal test_signal_7(a: TestMemberInfo, b: Array[TestMemberInfo], c: Dictionary[TestMemberInfo, TestMemberInfo])
signal test_signal_8(a: MyClass, b: Array[MyClass], c: Dictionary[MyClass, MyClass])
@warning_ignore_restore("unused_signal")
func test():
var script: Script = get_script()

View file

@ -23,6 +23,16 @@ var test_var_hard_array_my_enum: Array[TestMemberInfo.MyEnum]
var test_var_hard_array_resource: Array[Resource]
var test_var_hard_array_this: Array[TestMemberInfo]
var test_var_hard_array_my_class: Array[RefCounted]
var test_var_hard_dictionary: Dictionary
var test_var_hard_dictionary_int_variant: Dictionary[int, Variant]
var test_var_hard_dictionary_variant_int: Dictionary[Variant, int]
var test_var_hard_dictionary_int_int: Dictionary[int, int]
var test_var_hard_dictionary_variant_type: Dictionary[Variant.Type, Variant.Type]
var test_var_hard_dictionary_node_process_mode: Dictionary[Node.ProcessMode, Node.ProcessMode]
var test_var_hard_dictionary_my_enum: Dictionary[TestMemberInfo.MyEnum, TestMemberInfo.MyEnum]
var test_var_hard_dictionary_resource: Dictionary[Resource, Resource]
var test_var_hard_dictionary_this: Dictionary[TestMemberInfo, TestMemberInfo]
var test_var_hard_dictionary_my_class: Dictionary[RefCounted, RefCounted]
var test_var_hard_resource: Resource
var test_var_hard_this: TestMemberInfo
var test_var_hard_my_class: RefCounted
@ -33,13 +43,13 @@ func test_func_weak_null() -> Variant
func test_func_weak_int() -> Variant
func test_func_hard_variant() -> Variant
func test_func_hard_int() -> int
func test_func_args_1(_a: int, _b: Array[int], _c: int = 1, _d: Variant = 2) -> void
func test_func_args_1(_a: int, _b: Array[int], _c: Dictionary[int, int], _d: int = 1, _e: Variant = 2) -> void
func test_func_args_2(_a: Variant = 1, _b: Variant = null, _c: Variant = null, _d: Variant = 3) -> void
signal test_signal_1()
signal test_signal_2(a: Variant, b: Variant)
signal test_signal_3(a: int, b: Array[int])
signal test_signal_4(a: Variant.Type, b: Array[Variant.Type])
signal test_signal_5(a: TestMemberInfo.MyEnum, b: Array[TestMemberInfo.MyEnum])
signal test_signal_6(a: Resource, b: Array[Resource])
signal test_signal_7(a: TestMemberInfo, b: Array[TestMemberInfo])
signal test_signal_8(a: RefCounted, b: Array[RefCounted])
signal test_signal_3(a: int, b: Array[int], c: Dictionary[int, int])
signal test_signal_4(a: Variant.Type, b: Array[Variant.Type], c: Dictionary[Variant.Type, Variant.Type])
signal test_signal_5(a: TestMemberInfo.MyEnum, b: Array[TestMemberInfo.MyEnum], c: Dictionary[TestMemberInfo.MyEnum, TestMemberInfo.MyEnum])
signal test_signal_6(a: Resource, b: Array[Resource], c: Dictionary[Resource, Resource])
signal test_signal_7(a: TestMemberInfo, b: Array[TestMemberInfo], c: Dictionary[TestMemberInfo, TestMemberInfo])
signal test_signal_8(a: RefCounted, b: Array[RefCounted], c: Dictionary[RefCounted, RefCounted])

View file

@ -1,7 +1,5 @@
# GH-82169
const Utils = preload("../../utils.notest.gd")
class A:
static var test_static_var_a1
static var test_static_var_a2

View file

@ -3,7 +3,6 @@ class MyClass:
enum MyEnum {A, B, C}
const Utils = preload("../../utils.notest.gd")
const Other = preload("./metatypes.notest.gd")
var test_native := JSON

View file

@ -0,0 +1,8 @@
func get_parse_string(t: Variant):
return t.parse_string
func test():
var a: Callable = JSON.parse_string
var b: Callable = get_parse_string(JSON)
prints(a.call("{\"test\": \"a\"}"), a.is_valid())
prints(b.call("{\"test\": \"b\"}"), b.is_valid())

View file

@ -0,0 +1,3 @@
GDTEST_OK
{ "test": "a" } false
{ "test": "b" } false

View file

@ -1,17 +1,11 @@
GDTEST_OK
>> WARNING
>> Line: 5
>> SHADOWED_VARIABLE
>> The local function parameter "a" is shadowing an already-declared variable at line 3.
>> WARNING
>> Line: 15
>> SHADOWED_VARIABLE
>> The local function parameter "v" is shadowing an already-declared variable at line 13.
~~ WARNING at line 5: (SHADOWED_VARIABLE) The local function parameter "a" is shadowing an already-declared variable at line 3 in the current class.
~~ WARNING at line 15: (SHADOWED_VARIABLE) The local function parameter "v" is shadowing an already-declared variable at line 13 in the current class.
a
1
b
1
(1, 1)
(0, 0)
(6, 1)
(0, 0)
(1.0, 1.0)
(0.0, 0.0)
(6.0, 1.0)
(0.0, 0.0)

View file

@ -0,0 +1,50 @@
# https://github.com/godotengine/godot/issues/75658
class MyObj:
var callable: Callable
func run():
callable.call()
var prop:
set(value):
callable.call()
get:
callable.call()
return 0
func _on_some_signal():
callable.call()
func _init(p_callable: Callable):
self.callable = p_callable
signal some_signal
var obj: MyObj
func test():
# Call.
obj = MyObj.new(nullify_obj)
obj.run()
print(obj)
# Get.
obj = MyObj.new(nullify_obj)
var _aux = obj.prop
print(obj)
# Set.
obj = MyObj.new(nullify_obj)
obj.prop = 1
print(obj)
# Signal handling.
obj = MyObj.new(nullify_obj)
@warning_ignore("return_value_discarded")
some_signal.connect(obj._on_some_signal)
some_signal.emit()
print(obj)
func nullify_obj():
obj = null

View file

@ -0,0 +1,5 @@
GDTEST_OK
<null>
<null>
<null>
<null>

View file

@ -6,6 +6,6 @@ class MyObj:
func test():
var obj_1 = MyObj.new()
var obj_2 = MyObj.new()
assert(obj_2.get_reference_count() == 1)
Utils.check(obj_2.get_reference_count() == 1)
obj_1.set(&"obj", obj_2)
assert(obj_2.get_reference_count() == 1)
Utils.check(obj_2.get_reference_count() == 1)

View file

@ -1,26 +1,26 @@
GDTEST_OK
===
prop1 setter (0, 0)
prop1 setter (1, 0)
prop1 setter (0.0, 0.0)
prop1 setter (1.0, 0.0)
---
prop1 setter <Inner>
subprop getter
subprop setter (1, 0)
subprop setter (1.0, 0.0)
===
prop2 setter <Inner>
subprop getter
subprop setter (1, 0)
subprop setter (1.0, 0.0)
===
prop3 setter (0, 0)
prop3 setter (0.0, 0.0)
prop3 getter
prop3 setter (1, 0)
prop3 setter (1.0, 0.0)
---
prop3 setter <Inner>
prop3 getter
subprop getter
subprop setter (1, 0)
subprop setter (1.0, 0.0)
===
prop4 setter <Inner>
prop4 getter
subprop getter
subprop setter (1, 0)
subprop setter (1.0, 0.0)

View file

@ -1,4 +1,4 @@
GDTEST_OK
setting vec from (0, 0) to (2, 0)
setting vec from (0, 0) to (0, 2)
vec is (0, 0)
setting vec from (0.0, 0.0) to (2.0, 0.0)
setting vec from (0.0, 0.0) to (0.0, 2.0)
vec is (0.0, 0.0)

View file

@ -12,4 +12,4 @@ func test() -> void:
node1.add_child(node2)
add_child(node3)
assert(get_node("_/Child") == $_/Child)
Utils.check(get_node("_/Child") == $_/Child)

View file

@ -14,33 +14,33 @@ func test():
func test_construct(v, f):
@warning_ignore("unsafe_call_argument")
Vector2(v, v) # Built-in type construct.
assert(not f) # Test unary operator reading from `nil`.
Utils.check(not f) # Test unary operator reading from `nil`.
func test_utility(v, f):
abs(v) # Utility function.
assert(not f) # Test unary operator reading from `nil`.
Utils.check(not f) # Test unary operator reading from `nil`.
func test_builtin_call(v, f):
@warning_ignore("unsafe_method_access")
v.angle() # Built-in method call.
assert(not f) # Test unary operator reading from `nil`.
Utils.check(not f) # Test unary operator reading from `nil`.
func test_builtin_call_validated(v: Vector2, f):
@warning_ignore("return_value_discarded")
v.abs() # Built-in method call validated.
assert(not f) # Test unary operator reading from `nil`.
Utils.check(not f) # Test unary operator reading from `nil`.
func test_object_call(v, f):
@warning_ignore("unsafe_method_access")
v.get_reference_count() # Native type method call.
assert(not f) # Test unary operator reading from `nil`.
Utils.check(not f) # Test unary operator reading from `nil`.
func test_object_call_method_bind(v: Resource, f):
@warning_ignore("return_value_discarded")
v.duplicate() # Native type method call with MethodBind.
assert(not f) # Test unary operator reading from `nil`.
Utils.check(not f) # Test unary operator reading from `nil`.
func test_object_call_method_bind_validated(v: RefCounted, f):
@warning_ignore("return_value_discarded")
v.get_reference_count() # Native type method call with validated MethodBind.
assert(not f) # Test unary operator reading from `nil`.
Utils.check(not f) # Test unary operator reading from `nil`.

View file

@ -4,21 +4,25 @@ func test():
print(-1.25, 0.25, 1.25)
print("hello world")
print(Vector2(0.25, 0.25))
print(Vector2(0.25, 1))
print(Vector2i(0, 0))
print(Rect2(0.25, 0.25, 0.5, 0.5))
print(Rect2(0.25, 0.25, 0.5, 1))
print(Rect2i(0, 0, 0, 0))
print(Vector3(0.25, 0.25, 0.25))
print(Vector3(0.25, 0.25, 1))
print(Vector3i(0, 0, 0))
print(Vector4(0.25, 0.25, 0.25, 1))
print(Vector4i(0, 0, 0, 0))
print(Transform2D.IDENTITY)
print(Plane(1, 2, 3, 4))
print(Quaternion(1, 2, 3, 4))
print(AABB(Vector3.ZERO, Vector3.ONE))
print(Basis.from_euler(Vector3(0, 0, 0)))
print(Transform3D.IDENTITY)
print(Projection.IDENTITY)
print(Color(1, 2, 3, 4))
print(StringName("hello"))

View file

@ -3,19 +3,22 @@ truefalse
-101
-1.250.251.25
hello world
(0.25, 0.25)
(0.25, 1.0)
(0, 0)
[P: (0.25, 0.25), S: (0.5, 0.5)]
[P: (0.25, 0.25), S: (0.5, 1.0)]
[P: (0, 0), S: (0, 0)]
(0.25, 0.25, 0.25)
(0.25, 0.25, 1.0)
(0, 0, 0)
[X: (1, 0), Y: (0, 1), O: (0, 0)]
[N: (1, 2, 3), D: 4]
(1, 2, 3, 4)
[P: (0, 0, 0), S: (1, 1, 1)]
[X: (1, 0, 0), Y: (0, 1, 0), Z: (0, 0, 1)]
[X: (1, 0, 0), Y: (0, 1, 0), Z: (0, 0, 1), O: (0, 0, 0)]
(0.25, 0.25, 0.25, 1.0)
(0, 0, 0, 0)
[X: (1.0, 0.0), Y: (0.0, 1.0), O: (0.0, 0.0)]
[N: (1.0, 2.0, 3.0), D: 4]
(1, 2, 3, 4)
[P: (0.0, 0.0, 0.0), S: (1.0, 1.0, 1.0)]
[X: (1.0, 0.0, 0.0), Y: (0.0, 1.0, 0.0), Z: (0.0, 0.0, 1.0)]
[X: (1.0, 0.0, 0.0), Y: (0.0, 1.0, 0.0), Z: (0.0, 0.0, 1.0), O: (0.0, 0.0, 0.0)]
[X: (1.0, 0.0, 0.0, 0.0), Y: (0.0, 1.0, 0.0, 0.0), Z: (0.0, 0.0, 1.0, 0.0), W: (0.0, 0.0, 0.0, 1.0)]
(1.0, 2.0, 3.0, 4.0)
hello
hello/world
RID(0)
@ -26,10 +29,10 @@ Node::[signal]property_list_changed
[255, 0, 1]
[-1, 0, 1]
[-1, 0, 1]
[-1, 0, 1]
[-1, 0, 1]
[-1.0, 0.0, 1.0]
[-1.0, 0.0, 1.0]
["hello", "world"]
[(1, 1), (0, 0)]
[(1, 1, 1), (0, 0, 0)]
[(1, 0, 0, 1), (0, 0, 1, 1), (0, 1, 0, 1)]
[(1, 1, 1, 1), (0, 0, 0, 0)]
[(1.0, 1.0), (0.0, 0.0)]
[(1.0, 1.0, 1.0), (0.0, 0.0, 0.0)]
[(1.0, 0.0, 0.0, 1.0), (0.0, 0.0, 1.0, 1.0), (0.0, 1.0, 0.0, 1.0)]
[(1.0, 1.0, 1.0, 1.0), (0.0, 0.0, 0.0, 0.0)]

View file

@ -1,6 +1,6 @@
func test():
var untyped: Variant = 32
var typed: Array[int] = [untyped]
assert(typed.get_typed_builtin() == TYPE_INT)
assert(str(typed) == '[32]')
Utils.check(typed.get_typed_builtin() == TYPE_INT)
Utils.check(str(typed) == '[32]')
print('ok')

View file

@ -1,12 +1,6 @@
GDTEST_OK
>> WARNING
>> Line: 6
>> NARROWING_CONVERSION
>> Narrowing conversion (float is converted to int and loses precision).
>> WARNING
>> Line: 8
>> NARROWING_CONVERSION
>> Narrowing conversion (float is converted to int and loses precision).
~~ WARNING at line 6: (NARROWING_CONVERSION) Narrowing conversion (float is converted to int and loses precision).
~~ WARNING at line 8: (NARROWING_CONVERSION) Narrowing conversion (float is converted to int and loses precision).
2
2
2

View file

@ -0,0 +1,6 @@
func test_param(dictionary: Dictionary[int, String]) -> void:
print(dictionary.get_typed_key_builtin() == TYPE_INT)
print(dictionary.get_typed_value_builtin() == TYPE_STRING)
func test() -> void:
test_param({ 123: "some_string" })

View file

@ -0,0 +1,7 @@
func test():
var untyped: Variant = 32
var typed: Dictionary[int, int] = { untyped: untyped }
Utils.check(typed.get_typed_key_builtin() == TYPE_INT)
Utils.check(typed.get_typed_value_builtin() == TYPE_INT)
Utils.check(str(typed) == '{ 32: 32 }')
print('ok')