Skip to content

Commit

Permalink
Merge pull request #5265 from peppy/i-has-custom-tooltip-nrt
Browse files Browse the repository at this point in the history
Update c# language version to 9
  • Loading branch information
peppy authored Jun 24, 2022
2 parents fceeb84 + d567280 commit add1d71
Show file tree
Hide file tree
Showing 49 changed files with 108 additions and 99 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Contains required properties for osu!framework projects. -->
<Project>
<PropertyGroup Label="C#">
<LangVersion>8.0</LangVersion>
<LangVersion>9.0</LangVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
9 changes: 9 additions & 0 deletions osu-framework.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=D9A367C9_002D4C1A_002D489F_002D9B05_002DA0CEA2B53B58/@EntryIndexedValue">ExplicitlyExcluded</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">SOLUTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeAccessorOwnerBody/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeDefaultValueWhenTypeEvident/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeDefaultValueWhenTypeNotEvident/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeMissingParentheses/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeConstructorOrDestructorBody/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeLocalFunctionBody/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeMethodOrOperatorBody/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeModifiersOrder/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeObjectCreationWhenTypeEvident/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeObjectCreationWhenTypeNotEvident/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeRedundantParentheses/@EntryIndexedValue">WARNING</s:String>
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeRedundantParentheses/@EntryIndexRemoved">True</s:Boolean>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTypeMemberModifiers/@EntryIndexedValue">WARNING</s:String>
Expand Down Expand Up @@ -120,6 +124,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MissingLinebreak/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MissingSpace/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MoreSpecificForeachVariableTypeAvailable/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MoveVariableDeclarationInsideLoopCondition/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MultipleSpaces/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MultipleStatementsOnOneLine/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MultipleTypeMembersOnOneLine/@EntryIndexedValue">WARNING</s:String>
Expand All @@ -133,6 +138,8 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PossibleInterfaceMemberAmbiguity/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PossibleMultipleEnumeration/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PrivateVariableCanBeMadeReadonly/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PropertyCanBeMadeInitOnly_002EGlobal/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PropertyCanBeMadeInitOnly_002ELocal/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PublicConstructorInAbstractClass/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantArgumentDefaultValue/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantArrayCreationExpression/@EntryIndexedValue">WARNING</s:String>
Expand All @@ -143,6 +150,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantCommaInAttributeList/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantCommaInEnumDeclaration/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantCommaInInitializer/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantDiscardDesignation/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantEmptyObjectCreationArgumentList/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantExplicitParamsArrayCreation/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantImmediateDelegateInvocation/@EntryIndexedValue">WARNING</s:String>
Expand Down Expand Up @@ -261,6 +269,7 @@
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_INTERNAL_MODIFIER/@EntryValue">Explicit</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/LOCAL_FUNCTION_BODY/@EntryValue">ExpressionBody</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/METHOD_OR_OPERATOR_BODY/@EntryValue">BlockBody</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/OBJECT_CREATION_WHEN_TYPE_EVIDENT/@EntryValue">ExplicitlyTyped</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/USE_HEURISTICS_FOR_BODY_STYLE/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ACCESSOR_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_LINQ_QUERY/@EntryValue">True</s:Boolean>
Expand Down
10 changes: 5 additions & 5 deletions osu.Framework.Tests/Bindables/BindableBindingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void TestDefaultChangedWithUpstreamRejection()

int changed1 = 0, changed2 = 0;

bindable1.DefaultChanged += v => changed1++;
bindable1.DefaultChanged += _ => changed1++;
bindable2.DefaultChanged += _ =>
{
bindable2.Default = "won't change";
Expand Down Expand Up @@ -169,7 +169,7 @@ public void TestValueChangedWithUpstreamRejection()

int changed1 = 0, changed2 = 0;

bindable1.ValueChanged += v => changed1++;
bindable1.ValueChanged += _ => changed1++;
bindable2.ValueChanged += _ =>
{
bindable2.Value = "won't change";
Expand Down Expand Up @@ -220,7 +220,7 @@ public void TestDisabledChangedWithUpstreamRejection()

int changed1 = 0, changed2 = 0;

bindable1.DisabledChanged += v => changed1++;
bindable1.DisabledChanged += _ => changed1++;
bindable2.DisabledChanged += _ =>
{
bindable2.Disabled = false;
Expand Down Expand Up @@ -269,7 +269,7 @@ public void TestMinValueChangedWithUpstreamRejection()

int changed1 = 0, changed2 = 0;

bindable1.MinValueChanged += v => changed1++;
bindable1.MinValueChanged += _ => changed1++;
bindable2.MinValueChanged += _ =>
{
bindable2.MinValue = 1337;
Expand Down Expand Up @@ -318,7 +318,7 @@ public void TestMaxValueChangedWithUpstreamRejection()

int changed1 = 0, changed2 = 0;

bindable1.MaxValueChanged += v => changed1++;
bindable1.MaxValueChanged += _ => changed1++;
bindable2.MaxValueChanged += _ =>
{
bindable2.MaxValue = 1337;
Expand Down
8 changes: 4 additions & 4 deletions osu.Framework.Tests/Bindables/BindableDictionaryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -817,17 +817,17 @@ public void TestDisabledWhenSetToTrueNotifiesSubscribers()
[Test]
public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscriber()
{
bindableStringByteDictionary.DisabledChanged += b => Assert.Fail();
bindableStringByteDictionary.DisabledChanged += _ => Assert.Fail();

bindableStringByteDictionary.Disabled = bindableStringByteDictionary.Disabled;
}

[Test]
public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscribers()
{
bindableStringByteDictionary.DisabledChanged += b => Assert.Fail();
bindableStringByteDictionary.DisabledChanged += b => Assert.Fail();
bindableStringByteDictionary.DisabledChanged += b => Assert.Fail();
bindableStringByteDictionary.DisabledChanged += _ => Assert.Fail();
bindableStringByteDictionary.DisabledChanged += _ => Assert.Fail();
bindableStringByteDictionary.DisabledChanged += _ => Assert.Fail();

bindableStringByteDictionary.Disabled = bindableStringByteDictionary.Disabled;
}
Expand Down
8 changes: 4 additions & 4 deletions osu.Framework.Tests/Bindables/BindableListTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1279,17 +1279,17 @@ public void TestDisabledWhenSetToTrueNotifiesSubscribers()
[Test]
public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscriber()
{
bindableStringList.DisabledChanged += b => Assert.Fail();
bindableStringList.DisabledChanged += _ => Assert.Fail();

bindableStringList.Disabled = bindableStringList.Disabled;
}

[Test]
public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscribers()
{
bindableStringList.DisabledChanged += b => Assert.Fail();
bindableStringList.DisabledChanged += b => Assert.Fail();
bindableStringList.DisabledChanged += b => Assert.Fail();
bindableStringList.DisabledChanged += _ => Assert.Fail();
bindableStringList.DisabledChanged += _ => Assert.Fail();
bindableStringList.DisabledChanged += _ => Assert.Fail();

bindableStringList.Disabled = bindableStringList.Disabled;
}
Expand Down
6 changes: 3 additions & 3 deletions osu.Framework.Tests/Configuration/InputConfigManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void TestOldConfigPersists()

using (var host = new TestHeadlessGameHost())
{
host.Run(new TestGame((h, config) => sensitivity = h.AvailableInputHandlers.OfType<MouseHandler>().First().Sensitivity.Value));
host.Run(new TestGame((h, _) => sensitivity = h.AvailableInputHandlers.OfType<MouseHandler>().First().Sensitivity.Value));
}

Assert.AreEqual(5, sensitivity);
Expand All @@ -55,7 +55,7 @@ public void TestNewConfigPersists()
{
using (var host = new TestHeadlessGameHost(bypassCleanup: true))
{
host.Run(new TestGame((h, config) =>
host.Run(new TestGame((h, _) =>
{
storage = h.Storage;
h.AvailableInputHandlers.OfType<MouseHandler>().First().Sensitivity.Value = 5;
Expand All @@ -69,7 +69,7 @@ public void TestNewConfigPersists()

using (var host = new TestHeadlessGameHost())
{
host.Run(new TestGame((h, config) => sensitivity = h.AvailableInputHandlers.OfType<MouseHandler>().First().Sensitivity.Value));
host.Run(new TestGame((h, _) => sensitivity = h.AvailableInputHandlers.OfType<MouseHandler>().First().Sensitivity.Value));
}

Assert.AreEqual(5, sensitivity);
Expand Down
6 changes: 3 additions & 3 deletions osu.Framework.Tests/Exceptions/TestLoadExceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void TestSingleAsyncAdd()
{
g.Add(loadTarget);
loadTarget.PerformAsyncLoad();
}, g => loadable.Parent == loadTarget);
}, _ => loadable.Parent == loadTarget);
});
}

Expand All @@ -121,7 +121,7 @@ public void TestDoubleAsyncLoad()
g.Add(loadTarget);
loadTarget.PerformAsyncLoad();
loadTarget.PerformAsyncLoad(false);
}, g => loadable.Parent == loadTarget);
}, _ => loadable.Parent == loadTarget);
});
}

Expand Down Expand Up @@ -209,7 +209,7 @@ public void TestDisposeAfterLoad()
runGameWithLogic(g =>
{
g.Add(loadTarget);
loadTarget.PerformAsyncLoad().ContinueWith(t => allowDispose = true);
loadTarget.PerformAsyncLoad().ContinueWith(_ => allowDispose = true);
}, g =>
{
// The following code is done here for a very specific reason, but can occur naturally in normal use
Expand Down
2 changes: 1 addition & 1 deletion osu.Framework.Tests/Graphics/LifetimeEntryManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public void TestFuzz()

addEntry();

manager.EntryCrossedBoundary += (entry, kind, direction) => changeLifetime();
manager.EntryCrossedBoundary += (_, _, _) => changeLifetime();
manager.Update(0);

int count = 1;
Expand Down
2 changes: 1 addition & 1 deletion osu.Framework.Tests/IO/TestLogging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void runWithIgnoreCount(int ignoreCount, int fireCount)
{
using (var host = new TestRunHeadlessGameHost())
{
host.ExceptionThrown += ex => ignoreCount-- > 0;
host.ExceptionThrown += _ => ignoreCount-- > 0;

var game = new TestGame();

Expand Down
12 changes: 6 additions & 6 deletions osu.Framework.Tests/IO/TestWebRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,9 @@ public void TestEventUnbindOnCompletion([Values(true, false)] bool async)
};

request.Started += () => { };
request.Failed += e => { };
request.DownloadProgress += (l1, l2) => { };
request.UploadProgress += (l1, l2) => { };
request.Failed += _ => { };
request.DownloadProgress += (_, _) => { };
request.UploadProgress += (_, _) => { };

Assert.DoesNotThrow(request.Perform);

Expand Down Expand Up @@ -553,9 +553,9 @@ public void TestUnbindOnDispose([Values(true, false)] bool async)
using (request)
{
request.Started += () => { };
request.Failed += e => { };
request.DownloadProgress += (l1, l2) => { };
request.UploadProgress += (l1, l2) => { };
request.Failed += _ => { };
request.DownloadProgress += (_, _) => { };
request.UploadProgress += (_, _) => { };

Assert.DoesNotThrow(request.Perform);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void TestOnCompleteBindingImmediateExecution()
Child = container = new Container();

completedFired = 0;
container.FadeIn(500).Then().FadeOut().OnComplete(a => { completedFired++; });
container.FadeIn(500).Then().FadeOut().OnComplete(_ => { completedFired++; });
});

AddAssert("not immediately fired", () => completedFired == 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public TestVisibilityContainer(bool? startHidden = true, Color4? colour = null)
},
};

State.ValueChanged += e => FireCount++;
State.ValueChanged += _ => FireCount++;
}

public int FireCount { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void load()

protected override void LoadComplete()
{
controlPoints.BindCollectionChanged((_, __) =>
controlPoints.BindCollectionChanged((_, _) =>
{
var copy = controlPoints.ToArray();
if (copy.Length != 3)
Expand Down
14 changes: 7 additions & 7 deletions osu.Framework.Tests/Visual/Drawables/TestSceneComplexBlending.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,13 @@ public TestSceneComplexBlending()
blendingAlphaSrcDropdown.Current.Value = BlendingType.One;
blendingAlphaDestDropdown.Current.Value = BlendingType.One;

colourModeDropdown.Current.ValueChanged += v => updateBlending();
colourEquation.Current.ValueChanged += v => updateBlending();
alphaEquation.Current.ValueChanged += v => updateBlending();
blendingSrcDropdown.Current.ValueChanged += v => updateBlending();
blendingDestDropdown.Current.ValueChanged += v => updateBlending();
blendingAlphaSrcDropdown.Current.ValueChanged += v => updateBlending();
blendingAlphaDestDropdown.Current.ValueChanged += v => updateBlending();
colourModeDropdown.Current.ValueChanged += _ => updateBlending();
colourEquation.Current.ValueChanged += _ => updateBlending();
alphaEquation.Current.ValueChanged += _ => updateBlending();
blendingSrcDropdown.Current.ValueChanged += _ => updateBlending();
blendingDestDropdown.Current.ValueChanged += _ => updateBlending();
blendingAlphaSrcDropdown.Current.ValueChanged += _ => updateBlending();
blendingAlphaDestDropdown.Current.ValueChanged += _ => updateBlending();
}

private void switchToCustomBlending()
Expand Down
2 changes: 1 addition & 1 deletion osu.Framework.Tests/Visual/Input/TestSceneInputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private void setCursorConfineRect(bool enabled)
Width = host.Window.ClientSize.Width * 2 / 3f,
Height = host.Window.ClientSize.Height * 2 / 3f,
}
: (RectangleF?)null;
: null;
}
}
}
8 changes: 4 additions & 4 deletions osu.Framework.Tests/Visual/Input/TestSceneTouchInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,10 @@ protected override bool Handle(UIEvent e)

break;

case MouseDownEvent _:
case MouseMoveEvent _:
case DragEvent _:
case MouseUpEvent _:
case MouseDownEvent:
case MouseMoveEvent:
case DragEvent:
case MouseUpEvent:
if (HandleMouse?.Invoke((MouseEvent)e) != false)
{
MouseEvents.Enqueue((MouseEvent)e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ private void clickOutsideStep()
});
}

private void addBoxStep(Action<Drawable> boxFunc, int actionCount) => addBoxStep(boxFunc, Enumerable.Repeat(new Action(() => { }), actionCount).ToArray());
// ReSharper disable once RedundantTypeArgumentsOfMethod (can be removed with c# language version 10).
private void addBoxStep(Action<Drawable> boxFunc, int actionCount) => addBoxStep(boxFunc, Enumerable.Repeat<Action>(() => { }, actionCount).ToArray());

private void addBoxStep(Action<Drawable> boxFunc, params Action[] actions)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public TestSceneCountingText()

typeDropdown.Items = (CountType[])Enum.GetValues(typeof(CountType));
countType.BindTo(typeDropdown.Current);
countType.ValueChanged += v => beginStep(lastStep)();
countType.ValueChanged += _ => beginStep(lastStep)();

AddStep("1 -> 4 | 1 sec", beginStep(() => counter.CountTo(1).CountTo(4, 1000)));
AddStep("1 -> 4 | 3 sec", beginStep(() => counter.CountTo(1).CountTo(4, 3000)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public TestFocusedOverlayContainer(bool startHidden = true, bool blockScrollInpu
},
};

State.ValueChanged += e => FireCount++;
State.ValueChanged += _ => FireCount++;
}

public int FireCount { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void TestSimpleText() => createContent((anchor, popover) =>
});

[Test]
public void TestSizingDirectly() => createContent((anchor, popover) =>
public void TestSizingDirectly() => createContent((_, popover) =>
{
popover.Size = new Vector2(200, 100);

Expand Down
Loading

0 comments on commit add1d71

Please sign in to comment.