Skip to content

Commit

Permalink
Merge pull request #6363 from Youssef1313/patch-26
Browse files Browse the repository at this point in the history
Move from .NET 7 RC1 to .NET 7.0.101
  • Loading branch information
mavasani committed Dec 16, 2022
2 parents 7af823a + 3112060 commit 79cc002
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 94 deletions.
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<!-- Use the correct compiler version -->
<UsingToolMicrosoftNetCompilers>true</UsingToolMicrosoftNetCompilers>
<!-- Dependencies from https://github.com/dotnet/roslyn -->
<MicrosoftNETCoreCompilersPackageVersion>4.3.0-2.final</MicrosoftNETCoreCompilersPackageVersion>
<MicrosoftNETCoreCompilersPackageVersion>4.4.0</MicrosoftNETCoreCompilersPackageVersion>
<MicrosoftNetCompilersToolsetVersion>$(MicrosoftNETCoreCompilersPackageVersion)</MicrosoftNetCompilersToolsetVersion>
<CodeStyleAnalyersVersion>$(MicrosoftNETCoreCompilersPackageVersion)</CodeStyleAnalyersVersion>
<!-- Roslyn -->
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"tools": {
"dotnet": "7.0.100-rc.1.22431.12",
"dotnet": "7.0.101",
"runtimes": {
"dotnet": [
"3.1.7",
Expand All @@ -13,7 +13,7 @@
"xcopy-msbuild": "16.10.0-preview2"
},
"sdk": {
"version": "7.0.100-rc.1.22431.12",
"version": "7.0.101",
"allowPrerelease": true,
"rollForward": "patch"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ private static ImmutableHashSet<INamedTypeSymbol> CreateSymbolSet(Compilation co
continue;
}

if (set == null)
{
set = new HashSet<INamedTypeSymbol>();
}
set ??= new HashSet<INamedTypeSymbol>();

set.Add(symbol);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,8 @@ bool TryGetConstructedDictionaryType(INamedTypeSymbol derived, [NotNullWhen(true
constructedDictionaryType = derived.GetBaseTypesAndThis()
.FirstOrDefault(x => x.OriginalDefinition.Equals(idictionaryType, SymbolEqualityComparer.Default));

if (constructedDictionaryType is null)
{
constructedDictionaryType = derived.AllInterfaces
constructedDictionaryType ??= derived.AllInterfaces
.FirstOrDefault(x => x.OriginalDefinition.Equals(idictionaryType, SymbolEqualityComparer.Default));
}

return constructedDictionaryType is not null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ protected enum CallKinds

ISymbol? symbol = GetCallerMethodSymbol(node, semanticModel);

if (symbol == null)
{
symbol = GetEnclosingTypeSymbol(node, semanticModel);
}
symbol ??= GetEnclosingTypeSymbol(node, semanticModel);

return symbol;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static byte[] GetOrCreateResource(ref byte[]? resource, string name)
{
if (resource == null)
{
resource = GetResourceBlob(name);
resource ??= GetResourceBlob(name);
}

return resource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,19 +331,13 @@ private static bool TryGetEditorConfigOptionForSkippedNamespaces(AnalyzerOptions

if (file.IsShipping)
{
if (shippedText is null)
{
shippedText = new();
}
shippedText ??= new();

shippedText.Add(data);
}
else
{
if (unshippedText is null)
{
unshippedText = new();
}
unshippedText ??= new();

unshippedText.Add(data);
}
Expand Down
5 changes: 1 addition & 4 deletions src/Tools/GenerateDocumentationAndConfigFiles/JsonWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,7 @@ private static string EscapeString(string value)

if (c == '\"' || c == '\\' || ShouldAppendAsUnicode(c))
{
if (b == null)
{
b = new StringBuilder();
}
b ??= new StringBuilder();

if (count > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ public PropertySetAnalysisParameters(string typeToTrack, ConstructorMapper const
PropertySetAnalysisParameters propertySetAnalysisParameters,
params (int Line, int Column, string Method, HazardousUsageEvaluationResult Result)[] expectedResults)
{
if (expectedResults == null)
{
expectedResults = Array.Empty<(int Line, int Column, string MethodName, HazardousUsageEvaluationResult Result)>();
}
expectedResults ??= Array.Empty<(int Line, int Column, string MethodName, HazardousUsageEvaluationResult Result)>();

Project project = CreateProject(new string[] { source, TestTypeToTrackSource });
Compilation compilation = project.GetCompilationAsync().Result;
Expand Down Expand Up @@ -1361,10 +1358,7 @@ protected static List<SyntaxNode> GetSyntaxNodeList(SyntaxTree syntaxTree)

protected static List<SyntaxNode> GetSyntaxNodeList(SyntaxNode node, List<SyntaxNode> synList)
{
if (synList == null)
{
synList = new List<SyntaxNode>();
}
synList ??= new List<SyntaxNode>();

synList.Add(node);

Expand Down
4 changes: 2 additions & 2 deletions src/Utilities/Compiler/Extensions/IOperationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ public static ImmutableArray<IOperation> WithoutFullyImplicitOperations(this Imm
builder.AddRange(operations, i);
}
}
else if (builder != null)
else
{
builder.Add(operation);
builder?.Add(operation);
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/Utilities/Compiler/WordParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,7 @@ internal static bool ContainsWord(string text, WordParserOptions options, char p
/// </returns>
public string? PeekWord()
{
if (_peekedWord == null)
{
_peekedWord = NextWordCore();
}
_peekedWord ??= NextWordCore();

return _peekedWord;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ public void Free()

public void TrackAssignmentWithUnknownLocation(IAssignmentOperation assignmentOperation)
{
if (this.AssignmentsWithUnknownLocation == null)
{
this.AssignmentsWithUnknownLocation = PooledHashSet<IAssignmentOperation>.GetInstance();
}
this.AssignmentsWithUnknownLocation ??= PooledHashSet<IAssignmentOperation>.GetInstance();

this.AssignmentsWithUnknownLocation.Add(assignmentOperation);
}
Expand All @@ -59,11 +56,8 @@ public void TrackAssignmentWithUnknownLocation(IAssignmentOperation assignmentOp
IAssignmentOperation assignmentOperation,
AbstractLocation abstractLocation)
{
if (this.AbstractLocationsToAssignments == null)
{
this.AbstractLocationsToAssignments =
this.AbstractLocationsToAssignments ??=
PooledDictionary<AbstractLocation, PooledHashSet<IAssignmentOperation>>.GetInstance();
}

if (!this.AbstractLocationsToAssignments.TryGetValue(
abstractLocation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,7 @@ private bool GetNamesOfHazardousUsageTypes(INamedTypeSymbol containingType, [Not
(type, true),
out containingTypeName))
{
if (hazardousUsageTypeNames == null)
{
hazardousUsageTypeNames = PooledHashSet<string>.GetInstance();
}
hazardousUsageTypeNames ??= PooledHashSet<string>.GetInstance();

hazardousUsageTypeNames.Add(containingTypeName);
}
Expand All @@ -589,10 +586,7 @@ private bool GetNamesOfHazardousUsageTypes(INamedTypeSymbol containingType, [Not
Func<PropertySetAbstractValue, HazardousUsageEvaluationResult> evaluationFunction,
Func<AbstractLocation, PropertySetAbstractValue>? locationToAbstractValueMapping = null)
{
if (locationToAbstractValueMapping == null)
{
locationToAbstractValueMapping = this.GetAbstractValue;
}
locationToAbstractValueMapping ??= this.GetAbstractValue;

PointsToAbstractValue pointsToAbstractValue = this.GetPointsToAbstractValue(propertySetInstance);
HazardousUsageEvaluationResult result = HazardousUsageEvaluationResult.Unflagged;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,7 @@ private PropertySetAnalysis(PropertySetAnalysisDomain analysisDomain, PropertySe
return propertySetAnalysisResult;
}

if (allResults == null)
{
allResults = PooledDictionary<(Location Location, IMethodSymbol? Method), HazardousUsageEvaluationResult>.GetInstance();
}
allResults ??= PooledDictionary<(Location Location, IMethodSymbol? Method), HazardousUsageEvaluationResult>.GetInstance();

foreach (KeyValuePair<(Location Location, IMethodSymbol? Method), HazardousUsageEvaluationResult> kvp
in propertySetAnalysisResult.HazardousUsages)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,7 @@ public override TaintedDataAbstractValue DefaultVisit(IOperation operation, obje
TaintedDataAbstractValue childValue = Visit(childOperation, argument);
if (childValue.Kind == TaintedDataAbstractValueKind.Tainted)
{
if (taintedValues == null)
{
taintedValues = new List<TaintedDataAbstractValue>();
}
taintedValues ??= new List<TaintedDataAbstractValue>();

taintedValues.Add(childValue);
}
Expand Down Expand Up @@ -645,10 +642,7 @@ private void ProcessAssignmentOperation(IAssignmentOperation assignmentOperation
{
if (methodMatcher(method.Name, arguments))
{
if (taintedParameterPairs == null)
{
taintedParameterPairs = PooledHashSet<(string, string)>.GetInstance();
}
taintedParameterPairs ??= PooledHashSet<(string, string)>.GetInstance();

taintedParameterPairs.UnionWith(sourceToEnds.Where(s => taintedParameterNames.Contains(s.source)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ internal static class TaintedDataSymbolMapExtensions
{
if (methodMatcher(method.Name, arguments))
{
if (allTaintedTargets == null)
{
allTaintedTargets = PooledHashSet<string>.GetInstance();
}
allTaintedTargets ??= PooledHashSet<string>.GetInstance();

allTaintedTargets.UnionWith(taintedTargets);
}
Expand All @@ -71,10 +68,7 @@ internal static class TaintedDataSymbolMapExtensions
pointsToAnalysisResult[o.Kind, o.Syntax]).ToImmutableArray()));
if (positivePointsToTaintedTargets.Any())
{
if (allTaintedTargets == null)
{
allTaintedTargets = PooledHashSet<string>.GetInstance();
}
allTaintedTargets ??= PooledHashSet<string>.GetInstance();

allTaintedTargets.UnionWith(positivePointsToTaintedTargets.Select(s => s.target));
}
Expand All @@ -98,10 +92,7 @@ internal static class TaintedDataSymbolMapExtensions
arguments.Select(o => valueContentAnalysisResult[o.Kind, o.Syntax]).ToImmutableArray()));
if (positiveValueContentTaintedTargets.Any())
{
if (allTaintedTargets == null)
{
allTaintedTargets = PooledHashSet<string>.GetInstance();
}
allTaintedTargets ??= PooledHashSet<string>.GetInstance();

allTaintedTargets.UnionWith(positiveValueContentTaintedTargets.Select(s => s.target));
}
Expand Down Expand Up @@ -200,10 +191,7 @@ public static bool IsSourceParameter(this TaintedDataSymbolMap<SourceInfo> sourc
{
if (methodMatcher(method.Name, arguments))
{
if (taintedParameterPairs == null)
{
taintedParameterPairs = PooledHashSet<(string, string)>.GetInstance();
}
taintedParameterPairs ??= PooledHashSet<(string, string)>.GetInstance();

taintedParameterPairs.UnionWith(sourceToEnds.Where(s => taintedParameterNames.Contains(s.source)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,7 @@ private ImmutableHashSet<AnalysisEntity> GetChildAnalysisEntities(PointsToAbstra
return ImmutableHashSet<AnalysisEntity>.Empty;
}

if (predicate == null)
{
predicate = entity => IsChildAnalysisEntity(entity, instanceLocation);
}
predicate ??= entity => IsChildAnalysisEntity(entity, instanceLocation);

return GetChildAnalysisEntities(predicate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ private class Entry

lock (entry)
{
if (entry.Value == null)
{
entry.Value = valueFactory(key);
}
entry.Value ??= valueFactory(key);
}

return entry.Value;
Expand Down

0 comments on commit 79cc002

Please sign in to comment.