From 7e4284e418752fbf3a9ceaa93bf1c0abb6106941 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 27 Nov 2024 21:23:27 +0800 Subject: [PATCH] Update InspectCode nullability issues --- osu.Framework.Tests/Bindables/AggregateBindableTest.cs | 2 +- osu.Framework.Tests/Bindables/BindableDoubleTest.cs | 2 +- osu.Framework.Tests/Bindables/BindableFloatTest.cs | 2 +- osu.Framework.Tests/Bindables/BindableLeasingTest.cs | 2 +- .../Visual/Platform/FrameworkConfigVisualiser.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Framework.Tests/Bindables/AggregateBindableTest.cs b/osu.Framework.Tests/Bindables/AggregateBindableTest.cs index d74800a285..ffbc9d9c76 100644 --- a/osu.Framework.Tests/Bindables/AggregateBindableTest.cs +++ b/osu.Framework.Tests/Bindables/AggregateBindableTest.cs @@ -50,7 +50,7 @@ public void TestResultBounds() [Test] public void TestClassAggregate() { - var aggregate = new AggregateBindable((a, b) => new BoxedInt((a?.Value ?? 0) + (b?.Value ?? 0))); + var aggregate = new AggregateBindable((a, b) => new BoxedInt((a.Value) + (b.Value))); Assert.AreEqual(null, aggregate.Result.Value); diff --git a/osu.Framework.Tests/Bindables/BindableDoubleTest.cs b/osu.Framework.Tests/Bindables/BindableDoubleTest.cs index d076511803..8840a73402 100644 --- a/osu.Framework.Tests/Bindables/BindableDoubleTest.cs +++ b/osu.Framework.Tests/Bindables/BindableDoubleTest.cs @@ -125,7 +125,7 @@ public void TestParsingNumberLocale(double value, string locale, string expected CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(locale); var bindable = new BindableDouble(value); - string? asString = bindable.ToString(); + string asString = bindable.ToString(); Assert.AreEqual(expected, asString); Assert.DoesNotThrow(() => bindable.Parse(asString, CultureInfo.CurrentCulture)); Assert.AreEqual(value, bindable.Value, Precision.DOUBLE_EPSILON); diff --git a/osu.Framework.Tests/Bindables/BindableFloatTest.cs b/osu.Framework.Tests/Bindables/BindableFloatTest.cs index 200988ee85..78792c2a97 100644 --- a/osu.Framework.Tests/Bindables/BindableFloatTest.cs +++ b/osu.Framework.Tests/Bindables/BindableFloatTest.cs @@ -112,7 +112,7 @@ public void TestParsingNumberLocale(float value, string locale, string expected) CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(locale); var bindable = new BindableFloat(value); - string? asString = bindable.ToString(); + string asString = bindable.ToString(); Assert.AreEqual(expected, asString); Assert.DoesNotThrow(() => bindable.Parse(asString, CultureInfo.CurrentCulture)); Assert.AreEqual(value, bindable.Value, Precision.FLOAT_EPSILON); diff --git a/osu.Framework.Tests/Bindables/BindableLeasingTest.cs b/osu.Framework.Tests/Bindables/BindableLeasingTest.cs index fc2323e67b..4bb5419625 100644 --- a/osu.Framework.Tests/Bindables/BindableLeasingTest.cs +++ b/osu.Framework.Tests/Bindables/BindableLeasingTest.cs @@ -95,7 +95,7 @@ public void TestDoubleLeaseFails() public void TestIncorrectEndLease() { // end a lease when no lease exists. - Assert.Throws(() => original.EndLease(null)); + Assert.Throws(() => original.EndLease(null!)); // end a lease with an incorrect bindable original.BeginLease(true); diff --git a/osu.Framework.Tests/Visual/Platform/FrameworkConfigVisualiser.cs b/osu.Framework.Tests/Visual/Platform/FrameworkConfigVisualiser.cs index 56701f67e5..3f263cd991 100644 --- a/osu.Framework.Tests/Visual/Platform/FrameworkConfigVisualiser.cs +++ b/osu.Framework.Tests/Visual/Platform/FrameworkConfigVisualiser.cs @@ -59,6 +59,6 @@ protected override void LoadComplete() })); } - private void updateText() => valueText.Text = bindable.ToString() ?? ""; + private void updateText() => valueText.Text = bindable?.ToString() ?? ""; } }