diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs index cc99225a3356..57b5b09ebbda 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs @@ -1,6 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -689,7 +692,7 @@ namespace Godot /// /// The object to compare with. /// Whether or not the AABB and the object are equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Aabb other && Equals(other); } @@ -739,7 +742,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this AABB. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"{_position.ToString(format)}, {_size.ToString(format)}"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs index b4f7b82f60e8..589d6596f0b8 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs @@ -1,7 +1,10 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.ComponentModel; +#nullable enable + namespace Godot { /// @@ -1090,7 +1093,7 @@ namespace Godot /// /// The object to compare with. /// Whether or not the basis matrix and the object are exactly equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Basis other && Equals(other); } @@ -1140,7 +1143,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this basis. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"[X: {X.ToString(format)}, Y: {Y.ToString(format)}, Z: {Z.ToString(format)}]"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs index 293e680067f2..772209064cff 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs @@ -1,7 +1,10 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using Godot.NativeInterop; +#nullable enable + namespace Godot { /// @@ -1274,7 +1277,7 @@ namespace Godot /// /// The other object to compare. /// Whether or not the color and the other object are equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Color other && Equals(other); } @@ -1324,7 +1327,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this color. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"({R.ToString(format)}, {G.ToString(format)}, {B.ToString(format)}, {A.ToString(format)})"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs index 85b2b02c450e..f5dc34d824e9 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs @@ -1,6 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -382,7 +385,7 @@ namespace Godot /// /// The other object to compare. /// Whether or not the plane and the other object are exactly equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Plane other && Equals(other); } @@ -430,7 +433,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this plane. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"{_normal.ToString(format)}, {_d.ToString(format)}"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs index 155e90ff24f6..4c9e21fb7919 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs @@ -1,6 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -586,7 +589,7 @@ namespace Godot public readonly Vector2 GetFarPlaneHalfExtents() { var res = GetProjectionPlane(Planes.Far).Intersect3(GetProjectionPlane(Planes.Right), GetProjectionPlane(Planes.Top)); - return new Vector2(res.Value.X, res.Value.Y); + return res is null ? default : new Vector2(res.Value.X, res.Value.Y); } /// @@ -597,7 +600,7 @@ namespace Godot public readonly Vector2 GetViewportHalfExtents() { var res = GetProjectionPlane(Planes.Near).Intersect3(GetProjectionPlane(Planes.Right), GetProjectionPlane(Planes.Top)); - return new Vector2(res.Value.X, res.Value.Y); + return res is null ? default : new Vector2(res.Value.X, res.Value.Y); } /// @@ -981,7 +984,7 @@ namespace Godot /// /// The object to compare with. /// Whether or not the vector and the object are equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Projection other && Equals(other); } @@ -1018,7 +1021,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this projection. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"{X.X.ToString(format)}, {X.Y.ToString(format)}, {X.Z.ToString(format)}, {X.W.ToString(format)}\n" + $"{Y.X.ToString(format)}, {Y.Y.ToString(format)}, {Y.Z.ToString(format)}, {Y.W.ToString(format)}\n" + diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs index 3d4591358680..2344e8c5104b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs @@ -1,6 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -769,7 +772,7 @@ namespace Godot /// /// The other object to compare. /// Whether or not the quaternion and the other object are exactly equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Quaternion other && Equals(other); } @@ -817,7 +820,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this quaternion. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)}, {W.ToString(format)})"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs index babb26960b80..71a35ab8094e 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs @@ -1,6 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -427,7 +430,7 @@ namespace Godot /// /// The other object to compare. /// Whether or not the rect and the other object are exactly equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Rect2 other && Equals(other); } @@ -475,7 +478,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this rect. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"{_position.ToString(format)}, {_size.ToString(format)}"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs index 49fba02b54fd..ef7e9eacd885 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs @@ -1,6 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -398,7 +401,7 @@ namespace Godot /// /// The other object to compare. /// Whether or not the rect and the other object are equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Rect2I other && Equals(other); } @@ -435,7 +438,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this rect. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"{_position.ToString(format)}, {_size.ToString(format)}"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rid.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rid.cs index 350626389b3a..fccae94eac5a 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Rid.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Rid.cs @@ -1,8 +1,11 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Godot.NativeInterop; +#nullable enable + namespace Godot { /// @@ -71,7 +74,7 @@ namespace Godot /// /// The other object to compare. /// Whether or not the color and the other object are equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Rid other && Equals(other); } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs index 386f5874649a..3443277feed9 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs @@ -1,7 +1,10 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -606,7 +609,7 @@ namespace Godot /// /// The object to compare with. /// Whether or not the transform and the object are exactly equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Transform2D other && Equals(other); } @@ -656,7 +659,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this transform. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"[X: {X.ToString(format)}, Y: {Y.ToString(format)}, O: {Origin.ToString(format)}]"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs index 2d09259dcb3a..f80c0bd8dd99 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs @@ -1,7 +1,10 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.ComponentModel; +#nullable enable + namespace Godot { /// @@ -630,7 +633,7 @@ namespace Godot /// /// The object to compare with. /// Whether or not the transform and the object are exactly equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Transform3D other && Equals(other); } @@ -680,7 +683,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this transform. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"[X: {Basis.X.ToString(format)}, Y: {Basis.Y.ToString(format)}, Z: {Basis.Z.ToString(format)}, O: {Origin.ToString(format)}]"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs index 4842dbc9afc8..a27a1ab1cf9d 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs @@ -1,6 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -954,7 +957,7 @@ namespace Godot /// /// The object to compare with. /// Whether or not the vector and the object are equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Vector2 other && Equals(other); } @@ -1016,7 +1019,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this vector. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"({X.ToString(format)}, {Y.ToString(format)})"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs index 215bb4df8ccc..104e30981f49 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs @@ -1,6 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -535,7 +538,7 @@ namespace Godot /// /// The object to compare with. /// Whether or not the vector and the object are equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Vector2I other && Equals(other); } @@ -572,7 +575,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this vector. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"({X.ToString(format)}, {Y.ToString(format)})"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs index d26d4662a0d0..54d698345f41 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs @@ -1,6 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -1056,7 +1059,7 @@ namespace Godot /// /// The object to compare with. /// Whether or not the vector and the object are equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Vector3 other && Equals(other); } @@ -1118,7 +1121,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this vector. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)})"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs index fe74ec88844d..4af9fd878b5f 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs @@ -1,6 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -590,7 +593,7 @@ namespace Godot /// /// The object to compare with. /// Whether or not the vector and the object are equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Vector3I other && Equals(other); } @@ -627,7 +630,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this vector. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)})"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs index eeaef5e46e61..87c01ad5ea66 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs @@ -1,6 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -838,7 +841,7 @@ namespace Godot /// /// The object to compare with. /// Whether or not the vector and the object are equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Vector4 other && Equals(other); } @@ -900,7 +903,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this vector. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)}, {W.ToString(format)})"; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs index a0a439352352..7d4d3dd353ff 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs @@ -1,6 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; +#nullable enable + namespace Godot { /// @@ -611,7 +614,7 @@ namespace Godot /// /// The object to compare with. /// Whether or not the vector and the object are equal. - public override readonly bool Equals(object obj) + public override readonly bool Equals([NotNullWhen(true)] object? obj) { return obj is Vector4I other && Equals(other); } @@ -648,7 +651,7 @@ namespace Godot /// Converts this to a string with the given . /// /// A string representation of this vector. - public readonly string ToString(string format) + public readonly string ToString(string? format) { return $"({X.ToString(format)}, {Y.ToString(format)}, {Z.ToString(format)}), {W.ToString(format)})"; }