Skip to content

Commit 2857ec6

Browse files
Remove unnnecessary null suppressions in Roslyn.sln
1 parent 3020e07 commit 2857ec6

File tree

132 files changed

+185
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+185
-185
lines changed

src/Analyzers/CSharp/Analyzers/UseExpressionBody/Helpers/UseExpressionBodyHelper`1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public bool CanOfferUseBlockBody(
186186
var languageVersion = declaration.GetLanguageVersion();
187187
if (languageVersion < LanguageVersion.CSharp7)
188188
{
189-
if (expressionBody!.Expression.IsKind(SyntaxKind.ThrowExpression))
189+
if (expressionBody.Expression.IsKind(SyntaxKind.ThrowExpression))
190190
{
191191
// If they're using a throw expression in a declaration and it's prior to C# 7
192192
// then always mark this as something that can be fixed by the analyzer. This way

src/Analyzers/Core/Analyzers/MatchFolderAndNamespace/AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private bool IsFileAndNamespaceMismatch(
147147

148148
var relativeDirectoryPath = PathUtilities.GetRelativePath(
149149
projectDir,
150-
PathUtilities.GetDirectoryName(namespaceDeclaration.SyntaxTree.FilePath)!);
150+
PathUtilities.GetDirectoryName(namespaceDeclaration.SyntaxTree.FilePath));
151151
var folders = relativeDirectoryPath.Split([Path.DirectorySeparatorChar], StringSplitOptions.RemoveEmptyEntries);
152152

153153
var expectedNamespace = PathMetadataUtilities.TryBuildNamespaceFromFolders(folders, GetSyntaxFacts(), rootNamespace);

src/Analyzers/Core/Analyzers/RemoveUnnecessarySuppressions/AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void AnalyzeAssemblyOrModuleAttribute(SyntaxNode attributeSyntax, Semanti
109109
}
110110
}
111111

112-
reportDiagnostic(Diagnostic.Create(LegacyFormatTargetDescriptor, targetValueOperation.Syntax.GetLocation(), properties!, targetSymbolString));
112+
reportDiagnostic(Diagnostic.Create(LegacyFormatTargetDescriptor, targetValueOperation.Syntax.GetLocation(), properties, targetSymbolString));
113113
return;
114114
}
115115
}

src/Analyzers/Core/Analyzers/UseCollectionInitializer/AbstractObjectCreationExpressionAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected UpdateExpressionState<TExpressionSyntax, TStatementSyntax> TryInitiali
9595
TObjectCreationExpressionSyntax rootExpression,
9696
CancellationToken cancellationToken)
9797
{
98-
var statement = rootExpression.FirstAncestorOrSelf<TStatementSyntax>()!;
98+
var statement = rootExpression.FirstAncestorOrSelf<TStatementSyntax>();
9999
if (statement != null)
100100
{
101101
var result =

src/Analyzers/Core/Analyzers/UseCollectionInitializer/UpdateExpressionState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ internal readonly struct UpdateExpressionState<
4747
/// <summary>
4848
/// The statement containing <see cref="StartExpression"/>
4949
/// </summary>
50-
public readonly TStatementSyntax? ContainingStatement = startExpression.FirstAncestorOrSelf<TStatementSyntax>()!;
50+
public readonly TStatementSyntax? ContainingStatement = startExpression.FirstAncestorOrSelf<TStatementSyntax>();
5151

5252
/// <summary>
5353
/// The name of the value being mutated. It is whatever the new object-creation or collection-builder is assigned to.

src/Analyzers/Core/Analyzers/ValidateFormatString/AbstractValidateFormatStringDiagnosticAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private bool ArgsIsArrayOfReferenceTypes(
200200
}
201201

202202
Debug.Assert(syntaxFacts.IsArgument(argsArgument));
203-
var expression = syntaxFacts.GetExpressionOfArgument(argsArgument)!;
203+
var expression = syntaxFacts.GetExpressionOfArgument(argsArgument);
204204
return semanticModel.GetTypeInfo(expression).ConvertedType;
205205
}
206206

src/Analyzers/Core/CodeFixes/ImplementInterface/ImplementInterfaceGenerator_Property.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private ImmutableArray<ISymbol> GeneratePropertyMembers(
8181
private static INamedTypeSymbol[] AttributesToRemove(Compilation compilation)
8282
{
8383
return new[] { compilation.ComAliasNameAttributeType(), compilation.TupleElementNamesAttributeType(),
84-
compilation.DynamicAttributeType(), compilation.NativeIntegerAttributeType() }.WhereNotNull().ToArray()!;
84+
compilation.DynamicAttributeType(), compilation.NativeIntegerAttributeType() }.WhereNotNull().ToArray();
8585
}
8686

8787
private IMethodSymbol? GenerateSetAccessor(

src/Analyzers/Core/CodeFixes/UseSystemHashCode/UseSystemHashCodeCodeFixProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected override async Task FixAllAsync(
7070

7171
// Only if there was a base.GetHashCode() do we pass in the ContainingType
7272
// so that we generate the same.
73-
var containingType = accessesBase ? method!.ContainingType : null;
73+
var containingType = accessesBase ? method.ContainingType : null;
7474
var components = generator.GetGetHashCodeComponents(
7575
generatorInternal, semanticModel.Compilation, containingType, members, justMemberReference: true);
7676

src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2464,7 +2464,7 @@ private BoundExpression CreateTupleLiteralConversion(SyntaxNode syntax, BoundTup
24642464
locationBuilder.Add(argument.NameColon?.Name.Location);
24652465
}
24662466

2467-
targetType = targetType.WithElementNames(sourceTuple.ArgumentNamesOpt!,
2467+
targetType = targetType.WithElementNames(sourceTuple.ArgumentNamesOpt,
24682468
locationBuilder.ToImmutableAndFree(),
24692469
errorPositions: default,
24702470
ImmutableArray.Create(tupleSyntax.Location));

src/Compilers/CSharp/Portable/Binder/Binder_Deconstruct.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ private BoundBadExpression MissingDeconstruct(BoundExpression receiver, SyntaxNo
717717
{
718718
if (receiver.Type?.IsErrorType() == false)
719719
{
720-
Error(diagnostics, ErrorCode.ERR_MissingDeconstruct, rightSyntax, receiver.Type!, numParameters);
720+
Error(diagnostics, ErrorCode.ERR_MissingDeconstruct, rightSyntax, receiver.Type, numParameters);
721721
}
722722

723723
outPlaceholders = default;

0 commit comments

Comments
 (0)