Skip to content

Commit e67ab95

Browse files
authored
Merge pull request #56111 from dotnet/merges/main-to-main-vs-deps
Merge main to main-vs-deps
2 parents 1865b5c + 719f12d commit e67ab95

File tree

37 files changed

+164
-252
lines changed

37 files changed

+164
-252
lines changed

src/Analyzers/CSharp/Analyzers/ConvertNamespace/ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private void AnalyzeNamespace(SyntaxNodeAnalysisContext context)
6868
diagnosticLocation,
6969
severity,
7070
ImmutableArray.Create(declaration.GetLocation()),
71-
ImmutableDictionary<string, string>.Empty);
71+
ImmutableDictionary<string, string?>.Empty);
7272
}
7373
}
7474
}

src/Analyzers/CSharp/Analyzers/ConvertNamespace/ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private void AnalyzeNamespace(SyntaxNodeAnalysisContext context)
7070
diagnosticLocation,
7171
severity,
7272
ImmutableArray.Create(declaration.GetLocation()),
73-
ImmutableDictionary<string, string>.Empty);
73+
ImmutableDictionary<string, string?>.Empty);
7474
}
7575
}
7676
}

src/Analyzers/CSharp/Analyzers/UseIsNullCheck/CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ namespace Microsoft.CodeAnalysis.CSharp.UseIsNullCheck
1414
internal class CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer
1515
: AbstractBuiltInCodeStyleDiagnosticAnalyzer
1616
{
17-
private static readonly ImmutableDictionary<string, string> s_properties =
18-
ImmutableDictionary<string, string>.Empty.Add(UseIsNullConstants.Kind, UseIsNullConstants.CastAndEqualityKey);
17+
private static readonly ImmutableDictionary<string, string?> s_properties =
18+
ImmutableDictionary<string, string?>.Empty.Add(UseIsNullConstants.Kind, UseIsNullConstants.CastAndEqualityKey);
1919

2020
public CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer()
2121
: base(IDEDiagnosticIds.UseIsNullCheckDiagnosticId,

src/Analyzers/CSharp/Analyzers/UsePatternCombinators/CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ internal sealed class CSharpUsePatternCombinatorsDiagnosticAnalyzer :
2424
private static readonly LocalizableResourceString s_safePatternTitle = new(nameof(CSharpAnalyzersResources.Use_pattern_matching), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources));
2525
private static readonly LocalizableResourceString s_unsafePatternTitle = new(nameof(CSharpAnalyzersResources.Use_pattern_matching_may_change_code_meaning), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources));
2626

27-
private static readonly ImmutableDictionary<string, string> s_safeProperties = ImmutableDictionary<string, string>.Empty.Add(SafeKey, "");
27+
private static readonly ImmutableDictionary<string, string?> s_safeProperties = ImmutableDictionary<string, string?>.Empty.Add(SafeKey, "");
2828
private static readonly DiagnosticDescriptor s_unsafeDescriptor = CreateDescriptorWithId(
2929
IDEDiagnosticIds.UsePatternCombinatorsDiagnosticId,
3030
EnforceOnBuildValues.UsePatternCombinators,

src/Analyzers/Core/Analyzers/AbstractCodeQualityDiagnosticAnalyzer.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
#nullable disable
6-
75
using System.Collections.Immutable;
86
using Microsoft.CodeAnalysis.CodeActions;
97
using Microsoft.CodeAnalysis.CodeStyle;
@@ -55,7 +53,7 @@ protected static DiagnosticDescriptor CreateDescriptor(
5553
bool isUnnecessary,
5654
bool isEnabledByDefault = true,
5755
bool isConfigurable = true,
58-
LocalizableString description = null)
56+
LocalizableString? description = null)
5957
#pragma warning disable RS0030 // Do not used banned APIs
6058
=> new(
6159
id, title, messageFormat,

src/Analyzers/Core/Analyzers/AbstractParenthesesDiagnosticAnalyzer.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
#nullable disable
6-
75
using System.Collections.Immutable;
86
using Microsoft.CodeAnalysis.CodeStyle;
97
using Microsoft.CodeAnalysis.Options;

src/Analyzers/Core/Analyzers/AddRequiredParentheses/AbstractAddRequiredParenthesesDiagnosticAnalyzer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal abstract class AbstractAddRequiredParenthesesDiagnosticAnalyzer<
1919
where TBinaryLikeExpressionSyntax : TExpressionSyntax
2020
where TLanguageKindEnum : struct
2121
{
22-
private static readonly Dictionary<(bool includeInFixAll, string equivalenceKey), ImmutableDictionary<string, string>> s_cachedProperties =
22+
private static readonly Dictionary<(bool includeInFixAll, string equivalenceKey), ImmutableDictionary<string, string?>> s_cachedProperties =
2323
new();
2424

2525
private readonly IPrecedenceService _precedenceService;
@@ -38,7 +38,7 @@ static AbstractAddRequiredParenthesesDiagnosticAnalyzer()
3838
{
3939
foreach (var includeInFixAll in includeArray)
4040
{
41-
var properties = ImmutableDictionary<string, string>.Empty;
41+
var properties = ImmutableDictionary<string, string?>.Empty;
4242
if (includeInFixAll)
4343
{
4444
properties = properties.Add(AddRequiredParenthesesConstants.IncludeInFixAll, "");
@@ -54,7 +54,7 @@ static AbstractAddRequiredParenthesesDiagnosticAnalyzer()
5454
private static string GetEquivalenceKey(PerLanguageOption2<CodeStyleOption2<ParenthesesPreference>> parentPrecedence)
5555
=> parentPrecedence.Name;
5656

57-
private static ImmutableDictionary<string, string> GetProperties(bool includeInFixAll, string equivalenceKey)
57+
private static ImmutableDictionary<string, string?> GetProperties(bool includeInFixAll, string equivalenceKey)
5858
=> s_cachedProperties[(includeInFixAll, equivalenceKey)];
5959

6060
protected abstract int GetPrecedence(TBinaryLikeExpressionSyntax binaryLike);

src/Analyzers/Core/Analyzers/AddRequiredParentheses/AddRequiredParenthesesConstants.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
#nullable disable
6-
75
namespace Microsoft.CodeAnalysis.AddRequiredParentheses
86
{
97
internal static class AddRequiredParenthesesConstants

src/Analyzers/Core/Analyzers/Helpers/DeserializationConstructorCheck.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
#nullable disable
6-
75
using Microsoft.CodeAnalysis.Shared.Extensions;
86

97
namespace Microsoft.CodeAnalysis.Shared.Utilities
108
{
119
internal readonly struct DeserializationConstructorCheck
1210
{
13-
private readonly INamedTypeSymbol _iSerializableType;
14-
private readonly INamedTypeSymbol _serializationInfoType;
15-
private readonly INamedTypeSymbol _streamingContextType;
11+
private readonly INamedTypeSymbol? _iSerializableType;
12+
private readonly INamedTypeSymbol? _serializationInfoType;
13+
private readonly INamedTypeSymbol? _streamingContextType;
1614

1715
public DeserializationConstructorCheck(Compilation compilation)
1816
{

src/Analyzers/Core/Analyzers/Helpers/DiagnosticHelper.cs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
#nullable disable
6-
75
using System;
86
using System.Collections.Generic;
97
using System.Collections.Immutable;
@@ -41,8 +39,8 @@ public static Diagnostic Create(
4139
DiagnosticDescriptor descriptor,
4240
Location location,
4341
ReportDiagnostic effectiveSeverity,
44-
IEnumerable<Location> additionalLocations,
45-
ImmutableDictionary<string, string> properties,
42+
IEnumerable<Location>? additionalLocations,
43+
ImmutableDictionary<string, string?>? properties,
4644
params object[] messageArgs)
4745
{
4846
if (descriptor == null)
@@ -92,7 +90,7 @@ public static Diagnostic CreateWithLocationTags(
9290
{
9391
if (additionalUnnecessaryLocations.IsEmpty)
9492
{
95-
return Create(descriptor, location, effectiveSeverity, additionalLocations, ImmutableDictionary<string, string>.Empty, messageArgs);
93+
return Create(descriptor, location, effectiveSeverity, additionalLocations, ImmutableDictionary<string, string?>.Empty, messageArgs);
9694
}
9795

9896
var tagIndices = ImmutableDictionary<string, IEnumerable<int>>.Empty
@@ -103,7 +101,7 @@ public static Diagnostic CreateWithLocationTags(
103101
effectiveSeverity,
104102
additionalLocations.AddRange(additionalUnnecessaryLocations),
105103
tagIndices,
106-
ImmutableDictionary<string, string>.Empty,
104+
ImmutableDictionary<string, string?>.Empty,
107105
messageArgs);
108106
}
109107

@@ -136,12 +134,12 @@ public static Diagnostic CreateWithLocationTags(
136134
ReportDiagnostic effectiveSeverity,
137135
ImmutableArray<Location> additionalLocations,
138136
ImmutableArray<Location> additionalUnnecessaryLocations,
139-
ImmutableDictionary<string, string> properties,
137+
ImmutableDictionary<string, string?> properties,
140138
params object[] messageArgs)
141139
{
142140
if (additionalUnnecessaryLocations.IsEmpty)
143141
{
144-
return Create(descriptor, location, effectiveSeverity, additionalLocations, ImmutableDictionary<string, string>.Empty, messageArgs);
142+
return Create(descriptor, location, effectiveSeverity, additionalLocations, ImmutableDictionary<string, string?>.Empty, messageArgs);
145143
}
146144

147145
var tagIndices = ImmutableDictionary<string, IEnumerable<int>>.Empty
@@ -182,14 +180,14 @@ private static Diagnostic CreateWithLocationTags(
182180
ReportDiagnostic effectiveSeverity,
183181
IEnumerable<Location> additionalLocations,
184182
IDictionary<string, IEnumerable<int>> tagIndices,
185-
ImmutableDictionary<string, string> properties,
183+
ImmutableDictionary<string, string?> properties,
186184
params object[] messageArgs)
187185
{
188186
Contract.ThrowIfTrue(additionalLocations.IsEmpty());
189187
Contract.ThrowIfTrue(tagIndices.IsEmpty());
190188

191-
properties ??= ImmutableDictionary<string, string>.Empty;
192-
properties = properties.AddRange(tagIndices.Select(kvp => new KeyValuePair<string, string>(kvp.Key, EncodeIndices(kvp.Value, additionalLocations.Count()))));
189+
properties ??= ImmutableDictionary<string, string?>.Empty;
190+
properties = properties.AddRange(tagIndices.Select(kvp => new KeyValuePair<string, string?>(kvp.Key, EncodeIndices(kvp.Value, additionalLocations.Count()))));
193191

194192
return Create(descriptor, location, effectiveSeverity, additionalLocations, properties, messageArgs);
195193

@@ -230,8 +228,8 @@ public static Diagnostic CreateWithMessage(
230228
DiagnosticDescriptor descriptor,
231229
Location location,
232230
ReportDiagnostic effectiveSeverity,
233-
IEnumerable<Location> additionalLocations,
234-
ImmutableDictionary<string, string> properties,
231+
IEnumerable<Location>? additionalLocations,
232+
ImmutableDictionary<string, string?>? properties,
235233
LocalizableString message)
236234
{
237235
if (descriptor == null)
@@ -257,7 +255,7 @@ public static Diagnostic CreateWithMessage(
257255
properties);
258256
}
259257

260-
public static string GetHelpLinkForDiagnosticId(string id)
258+
public static string? GetHelpLinkForDiagnosticId(string id)
261259
{
262260
if (id == "RE0001")
263261
{
@@ -332,15 +330,15 @@ void IObjectWritable.WriteTo(ObjectWriter writer)
332330
}
333331
}
334332

335-
protected override string GetText(IFormatProvider formatProvider)
333+
protected override string GetText(IFormatProvider? formatProvider)
336334
{
337335
var messageFormat = _messageFormat.ToString(formatProvider);
338336
return messageFormat != null ?
339337
(_formatArguments.Length > 0 ? string.Format(formatProvider, messageFormat, _formatArguments) : messageFormat) :
340338
string.Empty;
341339
}
342340

343-
protected override bool AreEqual(object other)
341+
protected override bool AreEqual(object? other)
344342
{
345343
return other is LocalizableStringWithArguments otherResourceString &&
346344
_messageFormat.Equals(otherResourceString._messageFormat) &&

0 commit comments

Comments
 (0)