Skip to content

Commit

Permalink
Merge pull request #2266 from andy840119/upgrade-csharp-language-version
Browse files Browse the repository at this point in the history
Upgrade csharp language version to 12.
  • Loading branch information
andy840119 authored Aug 3, 2024
2 parents b42fa3e + df0a33f commit cd35eaf
Show file tree
Hide file tree
Showing 60 changed files with 63 additions and 177 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>10.0</LangVersion>
<LangVersion>12.0</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
namespace osu.Game.Rulesets.Karaoke.Tests.Editor.ChangeHandlers;

public abstract partial class BaseHitObjectPropertyChangeHandlerTest<TChangeHandler, THitObject> : BaseHitObjectChangeHandlerTest<TChangeHandler, THitObject>
where TChangeHandler : HitObjectPropertyChangeHandler<THitObject>, new() where THitObject : HitObject
{
}
where TChangeHandler : HitObjectPropertyChangeHandler<THitObject>, new() where THitObject : HitObject;
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,7 @@ protected override IStageEffectApplier ConvertToNoteStageAppliers(IEnumerable<St
}
}

private class TestCategory : StageElementCategory<TestStageElement, Lyric>
{
}
private class TestCategory : StageElementCategory<TestStageElement, Lyric>;

public class TestStageElement : StageElement, IComparable<TestStageElement>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Checks;

public abstract class BeatmapPropertyCheckTest<TCheck> : BaseCheckTest<TCheck> where TCheck : class, ICheck, new()
{
}
public abstract class BeatmapPropertyCheckTest<TCheck> : BaseCheckTest<TCheck> where TCheck : class, ICheck, new();
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Beatmaps;
public abstract class BaseBeatmapDetectorTest<TDetector, TObject, TConfig>
: BasePropertyDetectorTest<TDetector, KaraokeBeatmap, TObject, TConfig>
where TDetector : BeatmapPropertyDetector<TObject, TConfig>
where TConfig : GeneratorConfig, new()
{
}
where TConfig : GeneratorConfig, new();
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Beatmaps;
public abstract class BaseBeatmapGeneratorTest<TGenerator, TObject, TConfig>
: BasePropertyGeneratorTest<TGenerator, KaraokeBeatmap, TObject, TConfig>
where TGenerator : BeatmapPropertyGenerator<TObject, TConfig>
where TConfig : GeneratorConfig, new()
{
}
where TConfig : GeneratorConfig, new();
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Lyrics;
public abstract class BaseLyricDetectorTest<TDetector, TObject, TConfig>
: BasePropertyDetectorTest<TDetector, Lyric, TObject, TConfig>
where TDetector : LyricPropertyDetector<TObject, TConfig>
where TConfig : GeneratorConfig, new()
{
}
where TConfig : GeneratorConfig, new();
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Lyrics;

public abstract class BaseLyricGeneratorSelectorTest<TGenerator, TProperty>
: BaseGeneratorSelectorTest<TGenerator, Lyric, TProperty>
where TGenerator : PropertyGenerator<Lyric, TProperty>
{
}
where TGenerator : PropertyGenerator<Lyric, TProperty>;
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Lyrics;
public abstract class BaseLyricGeneratorTest<TGenerator, TObject, TConfig>
: BasePropertyGeneratorTest<TGenerator, Lyric, TObject, TConfig>
where TGenerator : LyricPropertyGenerator<TObject, TConfig>
where TConfig : GeneratorConfig, new()
{
}
where TConfig : GeneratorConfig, new();
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static KeyValuePair<TimeTag, RomanisationGenerateResult> ParseRomanisatio
{
var result = new RomanisationGenerateResult
{
FirstSyllable = str.StartsWith("^", StringComparison.Ordinal),
FirstSyllable = str.StartsWith('^'),
RomanisedSyllable = str.Replace("^", ""),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ public abstract class BaseLyricStageElementCategoryGeneratorTest<TGenerator, TOb
where TGenerator : StageInfoPropertyGenerator<TObject, TConfig>
where TObject : StageElementCategory<TStageElement, Lyric>
where TStageElement : StageElement, IComparable<TStageElement>, new()
where TConfig : GeneratorConfig, new()
{
}
where TConfig : GeneratorConfig, new();

public abstract class BaseStageElementCategoryGeneratorTest<TGenerator, TObject, TStageElement, THitObject, TConfig>
: BaseStageInfoPropertyGeneratorTest<TGenerator, TObject, TConfig>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Generator.Stages;
public abstract class BaseStageInfoPropertyGeneratorTest<TGenerator, TObject, TConfig>
: BasePropertyGeneratorTest<TGenerator, KaraokeBeatmap, TObject, TConfig>
where TGenerator : StageInfoPropertyGenerator<TObject, TConfig>
where TConfig : GeneratorConfig, new()
{
}
where TConfig : GeneratorConfig, new();
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static TimeTag ParseTimeTag(string? str)
var state = result.GetGroupValue<string>("state") == "start" ? TextIndex.IndexState.Start : TextIndex.IndexState.End;
int? time = result.GetGroupValue<int?>("time");
string? text = result.GetGroupValue<string?>("text");
bool? firstSyllable = text?.StartsWith("^");
bool? firstSyllable = text?.StartsWith('^');

return new TimeTag(new TextIndex(index, state), time)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
namespace osu.Game.Rulesets.Karaoke.Tests.IO.Serialization;

[Ignore($"Test case already in the {nameof(KaraokeSkinElementConverterTest)}")]
public class SkinJsonSerializableExtensionsTest
{
}
public class SkinJsonSerializableExtensionsTest;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

namespace osu.Game.Rulesets.Karaoke.Tests.Mods;

public partial class TestSceneKaraokeModClassicStage : KaraokeModStageTestScene<KaraokeModClassicStage, ClassicStageInfo>
{
}
public partial class TestSceneKaraokeModClassicStage : KaraokeModStageTestScene<KaraokeModClassicStage, ClassicStageInfo>;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

namespace osu.Game.Rulesets.Karaoke.Tests.Mods;

public partial class TestSceneKaraokeModPreviewStage : KaraokeModStageTestScene<KaraokeModPreviewStage, PreviewStageInfo>
{
}
public partial class TestSceneKaraokeModPreviewStage : KaraokeModStageTestScene<KaraokeModPreviewStage, PreviewStageInfo>;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
namespace osu.Game.Rulesets.Karaoke.Tests.Screens.Edit.Beatmap;

public abstract partial class BeatmapEditorScreenTestScene<T> : GenericEditorScreenTestScene<T, KaraokeBeatmapEditorScreenMode>
where T : BeatmapEditorScreen
{
}
where T : BeatmapEditorScreen;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.Tests.Screens.Edit.Beatmap;

public partial class TestSceneKaraokeBeatmapEditor : GenericEditorTestScene<KaraokeBeatmapEditor, KaraokeBeatmapEditorScreenMode>
{
}
public partial class TestSceneKaraokeBeatmapEditor : GenericEditorTestScene<KaraokeBeatmapEditor, KaraokeBeatmapEditorScreenMode>;
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,5 @@ public int CompareTo(TestStageElement? other)
}
}

private class TestStageElementCategory : StageElementCategory<TestStageElement, Lyric>
{
}
private class TestStageElementCategory : StageElementCategory<TestStageElement, Lyric>;
}
4 changes: 1 addition & 3 deletions osu.Game.Rulesets.Karaoke.Tests/Utils/TypeUtilsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,5 @@ public void TestChangeTypeToDifferentType()
Assert.AreEqual(default(double?), TypeUtils.ChangeType<double?>(null));
}

private class TestClass
{
}
private class TestClass;
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected override void ParseLine(Beatmap beatmap, Section section, string line)
// add translation queue
translations.Add(line);
}
else if (line.StartsWith("@", StringComparison.Ordinal))
else if (line.StartsWith('@'))
{
// Remove @ in time tag and add into lrc queue
lrcLines.Add(line[1..]);
Expand Down Expand Up @@ -127,7 +127,7 @@ private void processNotes(Beatmap beatmap, IList<string> lines)
var defaultNote = defaultNotes[i];

// Support multi note in one time tag, format like ([1;0.5;か]|1#|...)
if (!note.StartsWith("(", StringComparison.Ordinal) || !note.EndsWith(")", StringComparison.Ordinal))
if (!note.StartsWith('(') || !note.EndsWith(')'))
{
// Process and add note
applyNote(defaultNote, note);
Expand All @@ -147,7 +147,7 @@ private void processNotes(Beatmap beatmap, IList<string> lines)
string? ruby = defaultNote.RubyText?.ElementAtOrDefault(j).ToString();

// Format like [1;0.5;か]
if (note.StartsWith("[", StringComparison.Ordinal) && note.EndsWith("]", StringComparison.Ordinal))
if (note.StartsWith('[') && note.EndsWith(']'))
{
string[] rubyNoteProperty = note.Replace("[", string.Empty).Replace("]", string.Empty).Split(';');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@

namespace osu.Game.Rulesets.Karaoke.Configuration;

public class KaraokeRulesetEditConfigManager : InMemoryConfigManager<KaraokeRulesetEditSetting>
{
}
public class KaraokeRulesetEditConfigManager : InMemoryConfigManager<KaraokeRulesetEditSetting>;

public enum KaraokeRulesetEditSetting
{
}
public enum KaraokeRulesetEditSetting;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers;

public abstract partial class HitObjectsChangeHandler<THitObject> : HitObjectChangeHandler<THitObject> where THitObject : HitObject
{
}
public abstract partial class HitObjectsChangeHandler<THitObject> : HitObjectChangeHandler<THitObject> where THitObject : HitObject;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@

namespace osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics;

public interface ILyricPropertyChangeHandler : IHitObjectPropertyChangeHandler
{
}
public interface ILyricPropertyChangeHandler : IHitObjectPropertyChangeHandler;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics;

public abstract partial class LyricPropertyChangeHandler : HitObjectPropertyChangeHandler<Lyric>, ILyricPropertyChangeHandler
{
}
public abstract partial class LyricPropertyChangeHandler : HitObjectPropertyChangeHandler<Lyric>, ILyricPropertyChangeHandler;
4 changes: 1 addition & 3 deletions osu.Game.Rulesets.Karaoke/Edit/Generator/GeneratorConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@

namespace osu.Game.Rulesets.Karaoke.Edit.Generator;

public abstract class GeneratorConfig
{
}
public abstract class GeneratorConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.Lyrics.Notes;

public class NoteGeneratorConfig : GeneratorConfig
{
}
public class NoteGeneratorConfig : GeneratorConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.Lyrics.Romanisation;

public abstract class RomanisationGeneratorConfig : GeneratorConfig
{
}
public abstract class RomanisationGeneratorConfig : GeneratorConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.Lyrics.RubyTags;

public abstract class RubyTagGeneratorConfig : GeneratorConfig
{
}
public abstract class RubyTagGeneratorConfig : GeneratorConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.Lyrics.TimeTags.Zh;

public class ZhTimeTagGeneratorConfig : TimeTagGeneratorConfig
{
}
public class ZhTimeTagGeneratorConfig : TimeTagGeneratorConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.Stages.Preview;

public class PreviewStageInfoGeneratorConfig : StageInfoGeneratorConfig
{
}
public class PreviewStageInfoGeneratorConfig : StageInfoGeneratorConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@

namespace osu.Game.Rulesets.Karaoke.Edit.Generator.Stages;

public class StageInfoGeneratorConfig : GeneratorConfig
{
}
public class StageInfoGeneratorConfig : GeneratorConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ namespace osu.Game.Rulesets.Karaoke.Graphics.UserInterfaceV2;
/// A labelled text box which reveals an inline file chooser when clicked.
/// Will be replaced after has official one.
/// </summary>
public partial class LabelledImageSelector : LabelledTextBox
{
}
public partial class LabelledImageSelector : LabelledTextBox;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.IO.Serialization.Converters;

public class TranslationConverter : DictionaryConverter<CultureInfo, string>
{
}
public class TranslationConverter : DictionaryConverter<CultureInfo, string>;
4 changes: 1 addition & 3 deletions osu.Game.Rulesets.Karaoke/Judgements/KaraokeJudgement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.Judgements;

public class KaraokeJudgement : Judgement
{
}
public class KaraokeJudgement : Judgement;
4 changes: 1 addition & 3 deletions osu.Game.Rulesets.Karaoke/Mods/KaraokeModNoFail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.Mods;

public class KaraokeModNoFail : ModNoFail
{
}
public class KaraokeModNoFail : ModNoFail;
4 changes: 1 addition & 3 deletions osu.Game.Rulesets.Karaoke/Mods/KaraokeModPerfect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.Mods;

public class KaraokeModPerfect : ModPerfect
{
}
public class KaraokeModPerfect : ModPerfect;
4 changes: 1 addition & 3 deletions osu.Game.Rulesets.Karaoke/Mods/KaraokeModSuddenDeath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.Mods;

public class KaraokeModSuddenDeath : ModSuddenDeath
{
}
public class KaraokeModSuddenDeath : ModSuddenDeath;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.Objects.Workings;

public class InvalidWorkingPropertyAssignException : Exception
{
}
public class InvalidWorkingPropertyAssignException : Exception;
4 changes: 1 addition & 3 deletions osu.Game.Rulesets.Karaoke/Scoring/KaraokeHitWindows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.Scoring;

public abstract class KaraokeHitWindows : HitWindows
{
}
public abstract class KaraokeHitWindows : HitWindows;
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ private Popover createSelectionPopover()
},
};

private partial class AutoGenerateButton : EditorSectionButton
{
}
private partial class AutoGenerateButton : EditorSectionButton;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@ protected override OsuTextBox CreateComponent()
}
}

private partial class CreateRubyButton : EditorSectionButton
{
}
private partial class CreateRubyButton : EditorSectionButton;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Content;

public partial class MainContent : CompositeDrawable
{
}
public partial class MainContent : CompositeDrawable;
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,5 @@ protected override void OnRefreshButtonClicked()
=> verifier.Refresh();
}

protected abstract partial class LyricsIssueTable : LyricEditorIssueTable
{
}
protected abstract partial class LyricsIssueTable : LyricEditorIssueTable;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@

namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.States.Modes;

public interface IEditLanguageModeState : IHasEditStep<LanguageEditStep>, IHasSpecialAction<LanguageEditModeSpecialAction>
{
}
public interface IEditLanguageModeState : IHasEditStep<LanguageEditStep>, IHasSpecialAction<LanguageEditModeSpecialAction>;
Loading

0 comments on commit cd35eaf

Please sign in to comment.