-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge release/dev17.13 to main (#76387)
This is an automatically generated pull request from release/dev17.13 into main. Once all conflicts are resolved and all the tests pass, you are free to merge the pull request. 🐯 ## Troubleshooting conflicts ### Identify authors of changes which introduced merge conflicts Scroll to the bottom, then for each file containing conflicts copy its path into the following searches: - https://github.com/dotnet/roslyn/find/release/dev17.13 - https://github.com/dotnet/roslyn/find/main Usually the most recent change to a file between the two branches is considered to have introduced the conflicts, but sometimes it will be necessary to look for the conflicting lines and check the blame in each branch. Generally the author whose change introduced the conflicts should pull down this PR, fix the conflicts locally, then push up a commit resolving the conflicts. ### Resolve merge conflicts using your local repo Sometimes merge conflicts may be present on GitHub but merging locally will work without conflicts. This is due to differences between the merge algorithm used in local git versus the one used by GitHub. ``` bash git fetch --all git checkout -t upstream/merges/release/dev17.13-to-main git reset --hard upstream/main git merge upstream/release/dev17.13 # Fix merge conflicts git commit git push upstream merges/release/dev17.13-to-main --force ```
- Loading branch information
Showing
18 changed files
with
526 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
196 changes: 156 additions & 40 deletions
196
src/EditorFeatures/CSharpTest/Diagnostics/NamingStyles/EditorConfigNamingStyleParserTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
src/Features/TestUtilities/Options/NamingStyleTestUtilities.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Immutable; | ||
using System.Linq; | ||
using System.Xml.Linq; | ||
using Microsoft.CodeAnalysis.Diagnostics.Analyzers.NamingStyles; | ||
using Microsoft.CodeAnalysis.NamingStyles; | ||
|
||
namespace Microsoft.CodeAnalysis.Test.Utilities; | ||
|
||
internal static class NamingStyleTestUtilities | ||
{ | ||
public static string Inspect(this NamingRule rule) | ||
=> $"{rule.NamingStyle.Inspect()} {rule.SymbolSpecification.Inspect()} {rule.EnforcementLevel}"; | ||
|
||
public static string Inspect(this NamingStyle style) | ||
=> $"{style.Name} prefix='{style.Prefix}' suffix='{style.Suffix}' separator='{style.WordSeparator}'"; | ||
|
||
public static string Inspect(this SymbolSpecification symbol) | ||
=> $"{symbol.Name} {Inspect(symbol.ApplicableSymbolKindList)} {Inspect(symbol.ApplicableAccessibilityList)} {Inspect(symbol.RequiredModifierList)}"; | ||
|
||
public static string Inspect<T>(ImmutableArray<T> items) where T : notnull | ||
=> string.Join(",", items.Select(item => item.ToString())); | ||
|
||
public static string Inspect(this NamingStylePreferences preferences, string[]? excludeNodes = null) | ||
{ | ||
var xml = preferences.CreateXElement(); | ||
|
||
// filter out insignificant elements: | ||
var elementsToRemove = new List<XElement>(); | ||
foreach (var element in xml.DescendantsAndSelf()) | ||
{ | ||
if (excludeNodes != null && excludeNodes.Contains(element.Name.LocalName)) | ||
{ | ||
elementsToRemove.Add(element); | ||
} | ||
} | ||
|
||
foreach (var element in elementsToRemove) | ||
{ | ||
element.Remove(); | ||
} | ||
|
||
// replaces GUIDs with unique deterministic numbers: | ||
var ordinal = 0; | ||
var guidMap = new Dictionary<Guid, int>(); | ||
foreach (var element in xml.DescendantsAndSelf()) | ||
{ | ||
foreach (var attribute in element.Attributes()) | ||
{ | ||
if (Guid.TryParse(attribute.Value, out var guid)) | ||
{ | ||
if (!guidMap.TryGetValue(guid, out var existingOrdinal)) | ||
{ | ||
existingOrdinal = ordinal++; | ||
guidMap.Add(guid, existingOrdinal); | ||
} | ||
|
||
attribute.Value = existingOrdinal.ToString(); | ||
} | ||
} | ||
} | ||
|
||
return xml.ToString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.