Skip to content

Commit 1b45ed3

Browse files
committed
Analyzer fixes
1 parent f20262d commit 1b45ed3

34 files changed

+54
-93
lines changed

NuGet.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
77
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
88
<add key="dotnet7" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />
9+
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
910
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
1011
</packageSources>
1112
<disabledPackageSources />

eng/Versions.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
<MicrosoftNetCompilersToolsetVersion>$(MicrosoftCodeAnalysisVersion)</MicrosoftNetCompilersToolsetVersion>
2626
<MicrosoftCodeAnalysisCSharpAnalyzerTestingXunitVersion>1.0.1-beta1.*</MicrosoftCodeAnalysisCSharpAnalyzerTestingXunitVersion>
2727
<MicrosoftCodeAnalysisBannedApiAnalyzersVersion>3.3.2</MicrosoftCodeAnalysisBannedApiAnalyzersVersion>
28-
<MicrosoftCodeAnalysisNetAnalyzersVersion>7.0.0-preview1.22513.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
29-
<MicrosoftILVerificationVersion>7.0.0-preview.7.22375.6</MicrosoftILVerificationVersion>
28+
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0-preview1.22566.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
29+
<MicrosoftILVerificationVersion>8.0.0-alpha.1.23067.11</MicrosoftILVerificationVersion>
3030
<!-- This controls the version of the cecil package, or the version of cecil in the project graph
3131
when we build the cecil submodule. The reference assembly package will depend on this version of cecil.
3232
Keep this in sync with ProjectInfo.cs in the submodule. -->

src/ILLink.RoslynAnalyzer/TrimAnalysis/ParameterProxy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ partial struct ParameterProxy
1111
{
1212
public ParameterProxy (IParameterSymbol parameter)
1313
{
14-
Method = (new ((IMethodSymbol) parameter.ContainingSymbol));
14+
Method = new ((IMethodSymbol) parameter.ContainingSymbol);
1515
Index = (ParameterIndex) parameter.Ordinal + (Method.HasImplicitThis () ? 1 : 0);
1616
}
1717

src/ILLink.Shared/DataFlow/DefaultValueDictionary.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public DefaultValueDictionary<TKey, TValue> Clone ()
109109
// This type should never be used as a dictionary key.
110110
public override int GetHashCode () => throw new NotImplementedException ();
111111

112-
public static bool operator ==(DefaultValueDictionary<TKey, TValue> left, DefaultValueDictionary<TKey, TValue> right) => left.Equals(right);
113-
public static bool operator !=(DefaultValueDictionary<TKey, TValue> left, DefaultValueDictionary<TKey, TValue> right) => !(left == right);
112+
public static bool operator == (DefaultValueDictionary<TKey, TValue> left, DefaultValueDictionary<TKey, TValue> right) => left.Equals (right);
113+
public static bool operator != (DefaultValueDictionary<TKey, TValue> left, DefaultValueDictionary<TKey, TValue> right) => !(left == right);
114114
}
115115
}

src/ILLink.Shared/DataFlow/MaybeLattice.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public Maybe<T> Clone ()
2727
return new (value);
2828
}
2929

30-
public static bool operator ==(Maybe<T> left, Maybe<T> right) => left.Equals(right);
31-
public static bool operator !=(Maybe<T> left, Maybe<T> right) => !(left == right);
30+
public static bool operator == (Maybe<T> left, Maybe<T> right) => left.Equals (right);
31+
public static bool operator != (Maybe<T> left, Maybe<T> right) => !(left == right);
3232
}
3333

3434
public struct MaybeLattice<T, TValueLattice> : ILattice<Maybe<T>>

src/ILLink.Shared/DataFlow/ValueSet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ public bool Equals (ValueSet<TValue> other)
120120
}
121121
}
122122

123-
public static bool operator ==(ValueSet<TValue> left, ValueSet<TValue> right) => left.Equals(right);
124-
public static bool operator !=(ValueSet<TValue> left, ValueSet<TValue> right) => !(left == right);
123+
public static bool operator == (ValueSet<TValue> left, ValueSet<TValue> right) => left.Equals (right);
124+
public static bool operator != (ValueSet<TValue> left, ValueSet<TValue> right) => !(left == right);
125125

126126
public override int GetHashCode ()
127127
{

src/linker/Linker.Dataflow/HoistedLocalKey.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public HoistedLocalKey (FieldDefinition field)
2727

2828
public override int GetHashCode () => Field.GetHashCode ();
2929

30-
public static bool operator ==(HoistedLocalKey left, HoistedLocalKey right) => left.Equals(right);
31-
public static bool operator !=(HoistedLocalKey left, HoistedLocalKey right) => !(left == right);
30+
public static bool operator == (HoistedLocalKey left, HoistedLocalKey right) => left.Equals (right);
31+
public static bool operator != (HoistedLocalKey left, HoistedLocalKey right) => !(left == right);
3232
}
3333
}

src/linker/Linker.Dataflow/ValueNode.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public ValueBasicBlockPair (MultiValue value, int basicBlockIndex)
6565

6666
public override int GetHashCode () => HashUtils.Combine (Value.GetHashCode (), BasicBlockIndex);
6767

68-
public static bool operator ==(ValueBasicBlockPair left, ValueBasicBlockPair right) => left.Equals(right);
69-
public static bool operator !=(ValueBasicBlockPair left, ValueBasicBlockPair right) => !(left == right);
68+
public static bool operator == (ValueBasicBlockPair left, ValueBasicBlockPair right) => left.Equals (right);
69+
public static bool operator != (ValueBasicBlockPair left, ValueBasicBlockPair right) => !(left == right);
7070
}
7171
}

src/linker/Linker/LinkerAttributesInformation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public IEnumerable<T> GetAttributes<T> () where T : Attribute
106106
return attributeList.Cast<T> ();
107107
}
108108

109-
static Attribute? ProcessRequiresUnreferencedCodeAttribute (LinkContext context, ICustomAttributeProvider provider, CustomAttribute customAttribute)
109+
static RequiresUnreferencedCodeAttribute? ProcessRequiresUnreferencedCodeAttribute (LinkContext context, ICustomAttributeProvider provider, CustomAttribute customAttribute)
110110
{
111111
if (!(provider is MethodDefinition || provider is TypeDefinition))
112112
return null;

test/ILLink.RoslynAnalyzer.Tests/Verifiers/CSharpAnalyzerVerifier`1.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,7 @@ static bool IsMessageMatch (Diagnostic actual, ImmutableArray<string> actualArgu
585585

586586
public MatchQuality (int value)
587587
{
588-
if (value < 0) {
589-
throw new ArgumentOutOfRangeException (nameof (value));
590-
}
588+
ArgumentOutOfRangeException.ThrowIfNegative (value);
591589

592590
_value = value;
593591
}

0 commit comments

Comments
 (0)