From 455e142d37c993a0c80ff5241a10ae9327e46d43 Mon Sep 17 00:00:00 2001 From: George Marques Date: Fri, 17 Sep 2021 12:22:48 -0300 Subject: [PATCH] Allow comparing equality between builtin types and null --- core/variant/variant_op.cpp | 136 +++++++++++++++++ doc/classes/AABB.xml | 10 ++ doc/classes/Array.xml | 10 ++ doc/classes/Basis.xml | 10 ++ doc/classes/Callable.xml | 10 ++ doc/classes/Color.xml | 10 ++ doc/classes/Dictionary.xml | 10 ++ doc/classes/NodePath.xml | 10 ++ doc/classes/PackedByteArray.xml | 10 ++ doc/classes/PackedColorArray.xml | 10 ++ doc/classes/PackedFloat32Array.xml | 10 ++ doc/classes/PackedFloat64Array.xml | 10 ++ doc/classes/PackedInt32Array.xml | 10 ++ doc/classes/PackedInt64Array.xml | 10 ++ doc/classes/PackedStringArray.xml | 10 ++ doc/classes/PackedVector2Array.xml | 10 ++ doc/classes/PackedVector3Array.xml | 10 ++ doc/classes/Plane.xml | 10 ++ doc/classes/Quaternion.xml | 10 ++ doc/classes/RID.xml | 10 ++ doc/classes/Rect2.xml | 10 ++ doc/classes/Rect2i.xml | 10 ++ doc/classes/Signal.xml | 10 ++ doc/classes/String.xml | 10 ++ doc/classes/StringName.xml | 10 ++ doc/classes/Transform2D.xml | 10 ++ doc/classes/Transform3D.xml | 10 ++ doc/classes/Vector2.xml | 10 ++ doc/classes/Vector2i.xml | 10 ++ doc/classes/Vector3.xml | 10 ++ doc/classes/Vector3i.xml | 10 ++ doc/classes/bool.xml | 10 ++ doc/classes/float.xml | 10 ++ doc/classes/int.xml | 24 ++- .../features/compare-builtin-equals-null.gd | 138 ++++++++++++++++++ .../features/compare-builtin-equals-null.out | 35 +++++ .../compare-builtin-not-equals-null.gd | 138 ++++++++++++++++++ .../compare-builtin-not-equals-null.out | 35 +++++ .../features/compare-null-equals-builtin.gd | 138 ++++++++++++++++++ .../features/compare-null-equals-builtin.out | 35 +++++ .../compare-null-not-equals-builtin.gd | 138 ++++++++++++++++++ .../compare-null-not-equals-builtin.out | 35 +++++ 42 files changed, 1165 insertions(+), 7 deletions(-) create mode 100644 modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.gd create mode 100644 modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.out create mode 100644 modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.gd create mode 100644 modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.out create mode 100644 modules/gdscript/tests/scripts/runtime/features/compare-null-equals-builtin.gd create mode 100644 modules/gdscript/tests/scripts/runtime/features/compare-null-equals-builtin.out create mode 100644 modules/gdscript/tests/scripts/runtime/features/compare-null-not-equals-builtin.gd create mode 100644 modules/gdscript/tests/scripts/runtime/features/compare-null-not-equals-builtin.out diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp index a245aff35b9..b94588f480f 100644 --- a/core/variant/variant_op.cpp +++ b/core/variant/variant_op.cpp @@ -314,6 +314,74 @@ void Variant::_register_variant_operators() { register_op>(Variant::OP_EQUAL, Variant::PACKED_VECTOR3_ARRAY, Variant::PACKED_VECTOR3_ARRAY); register_op>(Variant::OP_EQUAL, Variant::PACKED_COLOR_ARRAY, Variant::PACKED_COLOR_ARRAY); + register_op>(Variant::OP_EQUAL, Variant::BOOL, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::INT, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::FLOAT, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::STRING, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::VECTOR2, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::VECTOR2I, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::RECT2, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::RECT2I, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::VECTOR3, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::VECTOR3I, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::TRANSFORM2D, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::PLANE, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::QUATERNION, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::AABB, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::BASIS, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::TRANSFORM3D, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::COLOR, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::STRING_NAME, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::NODE_PATH, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::RID, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::CALLABLE, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::SIGNAL, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::DICTIONARY, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::ARRAY, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::PACKED_BYTE_ARRAY, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::PACKED_INT32_ARRAY, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::PACKED_INT64_ARRAY, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::PACKED_FLOAT32_ARRAY, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::PACKED_FLOAT64_ARRAY, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::PACKED_STRING_ARRAY, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::PACKED_VECTOR2_ARRAY, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::PACKED_VECTOR3_ARRAY, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::PACKED_COLOR_ARRAY, Variant::NIL); + + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::BOOL); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::INT); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::FLOAT); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::STRING); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::VECTOR2); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::VECTOR2I); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::RECT2); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::RECT2I); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::VECTOR3); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::VECTOR3I); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::TRANSFORM2D); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PLANE); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::QUATERNION); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::AABB); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::BASIS); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::TRANSFORM3D); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::COLOR); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::STRING_NAME); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::NODE_PATH); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::RID); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::CALLABLE); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::SIGNAL); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::DICTIONARY); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::ARRAY); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_BYTE_ARRAY); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_INT32_ARRAY); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_INT64_ARRAY); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_FLOAT32_ARRAY); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_FLOAT64_ARRAY); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_STRING_ARRAY); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_VECTOR2_ARRAY); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_VECTOR3_ARRAY); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_COLOR_ARRAY); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::BOOL, Variant::BOOL); register_op>(Variant::OP_NOT_EQUAL, Variant::INT, Variant::INT); @@ -360,6 +428,74 @@ void Variant::_register_variant_operators() { register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_VECTOR3_ARRAY, Variant::PACKED_VECTOR3_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_COLOR_ARRAY, Variant::PACKED_COLOR_ARRAY); + register_op>(Variant::OP_NOT_EQUAL, Variant::BOOL, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::INT, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::FLOAT, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::STRING, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::VECTOR2, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::VECTOR2I, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::RECT2, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::RECT2I, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::VECTOR3, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::VECTOR3I, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM2D, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::PLANE, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::QUATERNION, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::AABB, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::BASIS, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM3D, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::COLOR, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::STRING_NAME, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::NODE_PATH, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::RID, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::CALLABLE, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::SIGNAL, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::DICTIONARY, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::ARRAY, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_BYTE_ARRAY, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_INT32_ARRAY, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_INT64_ARRAY, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_FLOAT32_ARRAY, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_FLOAT64_ARRAY, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_STRING_ARRAY, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_VECTOR2_ARRAY, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_VECTOR3_ARRAY, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_COLOR_ARRAY, Variant::NIL); + + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::BOOL); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::INT); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::FLOAT); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::STRING); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::VECTOR2); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::VECTOR2I); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::RECT2); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::RECT2I); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::VECTOR3); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::VECTOR3I); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::TRANSFORM2D); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PLANE); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::QUATERNION); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::AABB); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::BASIS); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::TRANSFORM3D); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::COLOR); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::STRING_NAME); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::NODE_PATH); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::RID); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::CALLABLE); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::SIGNAL); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::DICTIONARY); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::ARRAY); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_BYTE_ARRAY); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_INT32_ARRAY); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_INT64_ARRAY); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_FLOAT32_ARRAY); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_FLOAT64_ARRAY); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_STRING_ARRAY); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_VECTOR2_ARRAY); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_VECTOR3_ARRAY); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_COLOR_ARRAY); + register_op>(Variant::OP_LESS, Variant::BOOL, Variant::BOOL); register_op>(Variant::OP_LESS, Variant::INT, Variant::INT); register_op>(Variant::OP_LESS, Variant::INT, Variant::FLOAT); diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml index 4bc11e71663..46fb446881e 100644 --- a/doc/classes/AABB.xml +++ b/doc/classes/AABB.xml @@ -187,6 +187,11 @@ Returns a larger [AABB] that contains both this [AABB] and [code]with[/code]. + + + + + @@ -199,6 +204,11 @@ + + + + + diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 91450e50a4c..84e123d712f 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -345,6 +345,11 @@ Returns the minimum value contained in the array if all elements are of comparable types. If the elements can't be compared, [code]null[/code] is returned. + + + + + @@ -369,6 +374,11 @@ + + + + + diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml index 8fab84d885f..9d737ac93fe 100644 --- a/doc/classes/Basis.xml +++ b/doc/classes/Basis.xml @@ -118,6 +118,11 @@ The up axis (+Y) points as close to the [code]up[/code] vector as possible while staying perpendicular to the forward axis. The resulting Basis is orthonormalized. The [code]target[/code] and [code]up[/code] vectors cannot be zero, and cannot be parallel to each other. + + + + + @@ -150,6 +155,11 @@ This operator multiplies all components of the [Basis], which scales it uniformly. + + + + + diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml index 5228df706be..5f5ef4f964e 100644 --- a/doc/classes/Callable.xml +++ b/doc/classes/Callable.xml @@ -123,6 +123,11 @@ Returns [code]true[/code] if the object exists and has a valid function assigned, or is a custom callable. + + + + + @@ -130,6 +135,11 @@ Returns [code]true[/code] if both [Callable]s invoke different targets. + + + + + diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index f00a20e95e1..c85bc775c72 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -259,6 +259,11 @@ [/codeblocks] + + + + + @@ -313,6 +318,11 @@ + + + + + diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index 59088f33fd8..a6b97f3a751 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -288,12 +288,22 @@ Returns the list of keys in the [Dictionary]. + + + + + + + + + + diff --git a/doc/classes/NodePath.xml b/doc/classes/NodePath.xml index d05630d2773..87b3e39f487 100644 --- a/doc/classes/NodePath.xml +++ b/doc/classes/NodePath.xml @@ -166,12 +166,22 @@ Returns [code]true[/code] if the node path is empty. + + + + + + + + + + diff --git a/doc/classes/PackedByteArray.xml b/doc/classes/PackedByteArray.xml index 72f134e9e94..9b8057d91ac 100644 --- a/doc/classes/PackedByteArray.xml +++ b/doc/classes/PackedByteArray.xml @@ -314,6 +314,11 @@ Returns [code]true[/code] if the array is empty. + + + + + @@ -326,6 +331,11 @@ + + + + + diff --git a/doc/classes/PackedColorArray.xml b/doc/classes/PackedColorArray.xml index 2dfaefca238..fb744d75341 100644 --- a/doc/classes/PackedColorArray.xml +++ b/doc/classes/PackedColorArray.xml @@ -77,6 +77,11 @@ Returns [code]true[/code] if the array is empty. + + + + + @@ -89,6 +94,11 @@ + + + + + diff --git a/doc/classes/PackedFloat32Array.xml b/doc/classes/PackedFloat32Array.xml index 5c05dd9fa73..0c05e8f3c23 100644 --- a/doc/classes/PackedFloat32Array.xml +++ b/doc/classes/PackedFloat32Array.xml @@ -78,6 +78,11 @@ Returns [code]true[/code] if the array is empty. + + + + + @@ -90,6 +95,11 @@ + + + + + diff --git a/doc/classes/PackedFloat64Array.xml b/doc/classes/PackedFloat64Array.xml index 921ca23859e..e55bc0e6574 100644 --- a/doc/classes/PackedFloat64Array.xml +++ b/doc/classes/PackedFloat64Array.xml @@ -78,6 +78,11 @@ Returns [code]true[/code] if the array is empty. + + + + + @@ -90,6 +95,11 @@ + + + + + diff --git a/doc/classes/PackedInt32Array.xml b/doc/classes/PackedInt32Array.xml index dfc9cbf9392..887a7a1e51d 100644 --- a/doc/classes/PackedInt32Array.xml +++ b/doc/classes/PackedInt32Array.xml @@ -78,6 +78,11 @@ Returns [code]true[/code] if the array is empty. + + + + + @@ -90,6 +95,11 @@ + + + + + diff --git a/doc/classes/PackedInt64Array.xml b/doc/classes/PackedInt64Array.xml index dd38a4f5c2e..da661b12c31 100644 --- a/doc/classes/PackedInt64Array.xml +++ b/doc/classes/PackedInt64Array.xml @@ -78,6 +78,11 @@ Returns [code]true[/code] if the array is empty. + + + + + @@ -90,6 +95,11 @@ + + + + + diff --git a/doc/classes/PackedStringArray.xml b/doc/classes/PackedStringArray.xml index c2055531a55..8f16abaf37a 100644 --- a/doc/classes/PackedStringArray.xml +++ b/doc/classes/PackedStringArray.xml @@ -78,6 +78,11 @@ Returns [code]true[/code] if the array is empty. + + + + + @@ -90,6 +95,11 @@ + + + + + diff --git a/doc/classes/PackedVector2Array.xml b/doc/classes/PackedVector2Array.xml index 51b7c951da5..3678222da42 100644 --- a/doc/classes/PackedVector2Array.xml +++ b/doc/classes/PackedVector2Array.xml @@ -78,6 +78,11 @@ Returns [code]true[/code] if the array is empty. + + + + + @@ -96,6 +101,11 @@ + + + + + diff --git a/doc/classes/PackedVector3Array.xml b/doc/classes/PackedVector3Array.xml index 04a5e3d42ec..84d4297a3b0 100644 --- a/doc/classes/PackedVector3Array.xml +++ b/doc/classes/PackedVector3Array.xml @@ -77,6 +77,11 @@ Returns [code]true[/code] if the array is empty. + + + + + @@ -95,6 +100,11 @@ + + + + + diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml index c243c3ad15a..bc9b3cafb5d 100644 --- a/doc/classes/Plane.xml +++ b/doc/classes/Plane.xml @@ -123,12 +123,22 @@ Returns a copy of the plane, normalized. + + + + + + + + + + diff --git a/doc/classes/Quaternion.xml b/doc/classes/Quaternion.xml index 720188f67ec..7858ac732b8 100644 --- a/doc/classes/Quaternion.xml +++ b/doc/classes/Quaternion.xml @@ -133,6 +133,11 @@ Returns a copy of the quaternion, normalized to unit length. + + + + + @@ -187,6 +192,11 @@ + + + + + diff --git a/doc/classes/RID.xml b/doc/classes/RID.xml index ddd30dbc829..424a76ee44c 100644 --- a/doc/classes/RID.xml +++ b/doc/classes/RID.xml @@ -28,6 +28,11 @@ Returns the ID of the referenced resource. + + + + + @@ -46,6 +51,11 @@ + + + + + diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml index e6c8ff86b65..915099dc1cb 100644 --- a/doc/classes/Rect2.xml +++ b/doc/classes/Rect2.xml @@ -147,6 +147,11 @@ Returns a larger [Rect2] that contains this [Rect2] and [code]b[/code]. + + + + + @@ -159,6 +164,11 @@ + + + + + diff --git a/doc/classes/Rect2i.xml b/doc/classes/Rect2i.xml index a75c31a007b..2a98e0c0877 100644 --- a/doc/classes/Rect2i.xml +++ b/doc/classes/Rect2i.xml @@ -137,12 +137,22 @@ Returns a larger [Rect2i] that contains this [Rect2i] and [code]b[/code]. + + + + + + + + + + diff --git a/doc/classes/Signal.xml b/doc/classes/Signal.xml index 0e44abef427..11107c093d9 100644 --- a/doc/classes/Signal.xml +++ b/doc/classes/Signal.xml @@ -87,12 +87,22 @@ + + + + + + + + + + diff --git a/doc/classes/String.xml b/doc/classes/String.xml index eb6c52d6622..ab6b7a89efd 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -443,6 +443,11 @@ + + + + + @@ -479,6 +484,11 @@ + + + + + diff --git a/doc/classes/StringName.xml b/doc/classes/StringName.xml index 4c2619e782b..b4289b55646 100644 --- a/doc/classes/StringName.xml +++ b/doc/classes/StringName.xml @@ -29,6 +29,11 @@ Creates a new [StringName] from the given [String]. + + + + + @@ -41,6 +46,11 @@ + + + + + diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml index 948585aecbf..16af2a40759 100644 --- a/doc/classes/Transform2D.xml +++ b/doc/classes/Transform2D.xml @@ -113,6 +113,11 @@ Operations take place in global space. + + + + + @@ -157,6 +162,11 @@ This operator multiplies all components of the [Transform2D], including the origin vector, which scales it uniformly. + + + + + diff --git a/doc/classes/Transform3D.xml b/doc/classes/Transform3D.xml index 1c906f6a511..337e7d26931 100644 --- a/doc/classes/Transform3D.xml +++ b/doc/classes/Transform3D.xml @@ -83,6 +83,11 @@ The up axis (+Y) points as close to the [code]up[/code] vector as possible while staying perpendicular to the forward axis. The resulting transform is orthonormalized. The existing rotation, scale, and skew information from the original transform is discarded. The [code]target[/code] and [code]up[/code] vectors cannot be zero, cannot be parallel to each other, and are defined in global/parent space. + + + + + @@ -127,6 +132,11 @@ This operator multiplies all components of the [Transform3D], including the origin vector, which scales it uniformly. + + + + + diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index e61f1fe9519..b61d5bea0ea 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -225,6 +225,11 @@ Returns the vector scaled to unit length. Equivalent to [code]v / v.length()[/code]. + + + + + @@ -297,6 +302,11 @@ + + + + + diff --git a/doc/classes/Vector2i.xml b/doc/classes/Vector2i.xml index 212b1fd22b7..2e69d6efdfe 100644 --- a/doc/classes/Vector2i.xml +++ b/doc/classes/Vector2i.xml @@ -62,6 +62,11 @@ Returns a new vector with all components clamped between the components of [code]min[/code] and [code]max[/code], by running [method @GlobalScope.clamp] on each component. + + + + + @@ -140,6 +145,11 @@ + + + + + diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 78251b03420..61c34804891 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -208,6 +208,11 @@ Returns the vector scaled to unit length. Equivalent to [code]v / v.length()[/code]. + + + + + @@ -292,6 +297,11 @@ + + + + + diff --git a/doc/classes/Vector3i.xml b/doc/classes/Vector3i.xml index 75df182025f..bc3712ba3eb 100644 --- a/doc/classes/Vector3i.xml +++ b/doc/classes/Vector3i.xml @@ -68,6 +68,11 @@ Returns the axis of the vector's smallest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_Z]. + + + + + @@ -146,6 +151,11 @@ + + + + + diff --git a/doc/classes/bool.xml b/doc/classes/bool.xml index f3b16217e55..2d4ba8872e0 100644 --- a/doc/classes/bool.xml +++ b/doc/classes/bool.xml @@ -119,6 +119,11 @@ Cast an [int] value to a boolean value, this method will return [code]false[/code] if [code]0[/code] is passed in, and [code]true[/code] for all other ints. + + + + + @@ -133,6 +138,11 @@ Returns [code]true[/code] if left operand is [code]false[/code] and right operand is [code]true[/code]. + + + + + diff --git a/doc/classes/float.xml b/doc/classes/float.xml index 4bf04fe25f3..be8e1638e4c 100644 --- a/doc/classes/float.xml +++ b/doc/classes/float.xml @@ -40,6 +40,11 @@ Cast an [int] value to a floating-point value, [code]float(1)[/code] will be equal to [code]1.0[/code]. + + + + + @@ -189,6 +194,11 @@ Returns [code]true[/code] if this [float] is less than or equal to the given [int]. + + + + + diff --git a/doc/classes/int.xml b/doc/classes/int.xml index 32b5fe10125..dd523185df3 100644 --- a/doc/classes/int.xml +++ b/doc/classes/int.xml @@ -66,6 +66,11 @@ Cast a float value to an integer value, this method simply removes the number fractions (i.e. rounds [code]from[/code] towards zero), so for example [code]int(2.7)[/code] will be equals to 2, [code]int(0.1)[/code] will be equals to 0 and [code]int(-2.7)[/code] will be equals to -2. This operation is also called truncation. + + + + + @@ -172,13 +177,6 @@ [/codeblock] - - - - - Adds an [int] to a [float]. The result is a [float]. - - @@ -186,6 +184,13 @@ Adds two integers. + + + + + Adds an [int] to a [float]. The result is a [float]. + + @@ -260,6 +265,11 @@ Returns [code]true[/code] the left integer is less than or equal to the right one. + + + + + diff --git a/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.gd b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.gd new file mode 100644 index 00000000000..c6645c2c346 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.gd @@ -0,0 +1,138 @@ +func test(): + var value + + # null + value = null + print(value == null) + + # bool + value = false + print(value == null) + + # int + value = 0 + print(value == null) + + # float + value = 0.0 + print(value == null) + + # String + value = "" + print(value == null) + + # Vector2 + value = Vector2() + print(value == null) + + # Vector2i + value = Vector2i() + print(value == null) + + # Rect2 + value = Rect2() + print(value == null) + + # Rect2i + value = Rect2i() + print(value == null) + + # Vector3 + value = Vector3() + print(value == null) + + # Vector3i + value = Vector3i() + print(value == null) + + # Transform2D + value = Transform2D() + print(value == null) + + # Plane + value = Plane() + print(value == null) + + # Quaternion + value = Quaternion() + print(value == null) + + # AABB + value = AABB() + print(value == null) + + # Basis + value = Basis() + print(value == null) + + # Transform3D + value = Transform3D() + print(value == null) + + # Color + value = Color() + print(value == null) + + # StringName + value = &"" + print(value == null) + + # NodePath + value = ^"" + print(value == null) + + # RID + value = RID() + print(value == null) + + # Callable + value = Callable() + print(value == null) + + # Signal + value = Signal() + print(value == null) + + # Dictionary + value = {} + print(value == null) + + # Array + value = [] + print(value == null) + + # PackedByteArray + value = PackedByteArray() + print(value == null) + + # PackedInt32Array + value = PackedInt32Array() + print(value == null) + + # PackedInt64Array + value = PackedInt64Array() + print(value == null) + + # PackedFloat32Array + value = PackedFloat32Array() + print(value == null) + + # PackedFloat64Array + value = PackedFloat64Array() + print(value == null) + + # PackedStringArray + value = PackedStringArray() + print(value == null) + + # PackedVector2Array + value = PackedVector2Array() + print(value == null) + + # PackedVector3Array + value = PackedVector3Array() + print(value == null) + + # PackedColorArray + value = PackedColorArray() + print(value == null) diff --git a/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.out b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.out new file mode 100644 index 00000000000..639f6027b96 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.out @@ -0,0 +1,35 @@ +GDTEST_OK +true +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false diff --git a/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.gd b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.gd new file mode 100644 index 00000000000..ee622bf22f1 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.gd @@ -0,0 +1,138 @@ +func test(): + var value + + # null + value = null + print(value != null) + + # bool + value = false + print(value != null) + + # int + value = 0 + print(value != null) + + # float + value = 0.0 + print(value != null) + + # String + value = "" + print(value != null) + + # Vector2 + value = Vector2() + print(value != null) + + # Vector2i + value = Vector2i() + print(value != null) + + # Rect2 + value = Rect2() + print(value != null) + + # Rect2i + value = Rect2i() + print(value != null) + + # Vector3 + value = Vector3() + print(value != null) + + # Vector3i + value = Vector3i() + print(value != null) + + # Transform2D + value = Transform2D() + print(value != null) + + # Plane + value = Plane() + print(value != null) + + # Quaternion + value = Quaternion() + print(value != null) + + # AABB + value = AABB() + print(value != null) + + # Basis + value = Basis() + print(value != null) + + # Transform3D + value = Transform3D() + print(value != null) + + # Color + value = Color() + print(value != null) + + # StringName + value = &"" + print(value != null) + + # NodePath + value = ^"" + print(value != null) + + # RID + value = RID() + print(value != null) + + # Callable + value = Callable() + print(value != null) + + # Signal + value = Signal() + print(value != null) + + # Dictionary + value = {} + print(value != null) + + # Array + value = [] + print(value != null) + + # PackedByteArray + value = PackedByteArray() + print(value != null) + + # PackedInt32Array + value = PackedInt32Array() + print(value != null) + + # PackedInt64Array + value = PackedInt64Array() + print(value != null) + + # PackedFloat32Array + value = PackedFloat32Array() + print(value != null) + + # PackedFloat64Array + value = PackedFloat64Array() + print(value != null) + + # PackedStringArray + value = PackedStringArray() + print(value != null) + + # PackedVector2Array + value = PackedVector2Array() + print(value != null) + + # PackedVector3Array + value = PackedVector3Array() + print(value != null) + + # PackedColorArray + value = PackedColorArray() + print(value != null) diff --git a/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.out b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.out new file mode 100644 index 00000000000..d1e332afbaa --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.out @@ -0,0 +1,35 @@ +GDTEST_OK +false +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true diff --git a/modules/gdscript/tests/scripts/runtime/features/compare-null-equals-builtin.gd b/modules/gdscript/tests/scripts/runtime/features/compare-null-equals-builtin.gd new file mode 100644 index 00000000000..7649062fdaa --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/compare-null-equals-builtin.gd @@ -0,0 +1,138 @@ +func test(): + var value + + # null + value = null + print(null == value) + + # bool + value = false + print(null == value) + + # int + value = 0 + print(null == value) + + # float + value = 0.0 + print(null == value) + + # String + value = "" + print(null == value) + + # Vector2 + value = Vector2() + print(null == value) + + # Vector2i + value = Vector2i() + print(null == value) + + # Rect2 + value = Rect2() + print(null == value) + + # Rect2i + value = Rect2i() + print(null == value) + + # Vector3 + value = Vector3() + print(null == value) + + # Vector3i + value = Vector3i() + print(null == value) + + # Transform2D + value = Transform2D() + print(null == value) + + # Plane + value = Plane() + print(null == value) + + # Quaternion + value = Quaternion() + print(null == value) + + # AABB + value = AABB() + print(null == value) + + # Basis + value = Basis() + print(null == value) + + # Transform3D + value = Transform3D() + print(null == value) + + # Color + value = Color() + print(null == value) + + # StringName + value = &"" + print(null == value) + + # NodePath + value = ^"" + print(null == value) + + # RID + value = RID() + print(null == value) + + # Callable + value = Callable() + print(null == value) + + # Signal + value = Signal() + print(null == value) + + # Dictionary + value = {} + print(null == value) + + # Array + value = [] + print(null == value) + + # PackedByteArray + value = PackedByteArray() + print(null == value) + + # PackedInt32Array + value = PackedInt32Array() + print(null == value) + + # PackedInt64Array + value = PackedInt64Array() + print(null == value) + + # PackedFloat32Array + value = PackedFloat32Array() + print(null == value) + + # PackedFloat64Array + value = PackedFloat64Array() + print(null == value) + + # PackedStringArray + value = PackedStringArray() + print(null == value) + + # PackedVector2Array + value = PackedVector2Array() + print(null == value) + + # PackedVector3Array + value = PackedVector3Array() + print(null == value) + + # PackedColorArray + value = PackedColorArray() + print(null == value) diff --git a/modules/gdscript/tests/scripts/runtime/features/compare-null-equals-builtin.out b/modules/gdscript/tests/scripts/runtime/features/compare-null-equals-builtin.out new file mode 100644 index 00000000000..639f6027b96 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/compare-null-equals-builtin.out @@ -0,0 +1,35 @@ +GDTEST_OK +true +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false +false diff --git a/modules/gdscript/tests/scripts/runtime/features/compare-null-not-equals-builtin.gd b/modules/gdscript/tests/scripts/runtime/features/compare-null-not-equals-builtin.gd new file mode 100644 index 00000000000..8d5f9df1b82 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/compare-null-not-equals-builtin.gd @@ -0,0 +1,138 @@ +func test(): + var value + + # null + value = null + print(null != value) + + # bool + value = false + print(null != value) + + # int + value = 0 + print(null != value) + + # float + value = 0.0 + print(null != value) + + # String + value = "" + print(null != value) + + # Vector2 + value = Vector2() + print(null != value) + + # Vector2i + value = Vector2i() + print(null != value) + + # Rect2 + value = Rect2() + print(null != value) + + # Rect2i + value = Rect2i() + print(null != value) + + # Vector3 + value = Vector3() + print(null != value) + + # Vector3i + value = Vector3i() + print(null != value) + + # Transform2D + value = Transform2D() + print(null != value) + + # Plane + value = Plane() + print(null != value) + + # Quaternion + value = Quaternion() + print(null != value) + + # AABB + value = AABB() + print(null != value) + + # Basis + value = Basis() + print(null != value) + + # Transform3D + value = Transform3D() + print(null != value) + + # Color + value = Color() + print(null != value) + + # StringName + value = &"" + print(null != value) + + # NodePath + value = ^"" + print(null != value) + + # RID + value = RID() + print(null != value) + + # Callable + value = Callable() + print(null != value) + + # Signal + value = Signal() + print(null != value) + + # Dictionary + value = {} + print(null != value) + + # Array + value = [] + print(null != value) + + # PackedByteArray + value = PackedByteArray() + print(null != value) + + # PackedInt32Array + value = PackedInt32Array() + print(null != value) + + # PackedInt64Array + value = PackedInt64Array() + print(null != value) + + # PackedFloat32Array + value = PackedFloat32Array() + print(null != value) + + # PackedFloat64Array + value = PackedFloat64Array() + print(null != value) + + # PackedStringArray + value = PackedStringArray() + print(null != value) + + # PackedVector2Array + value = PackedVector2Array() + print(null != value) + + # PackedVector3Array + value = PackedVector3Array() + print(null != value) + + # PackedColorArray + value = PackedColorArray() + print(null != value) diff --git a/modules/gdscript/tests/scripts/runtime/features/compare-null-not-equals-builtin.out b/modules/gdscript/tests/scripts/runtime/features/compare-null-not-equals-builtin.out new file mode 100644 index 00000000000..d1e332afbaa --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/compare-null-not-equals-builtin.out @@ -0,0 +1,35 @@ +GDTEST_OK +false +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true +true