Browse Source

focus on CS8768 and CS8767

pull/3287/head
apmoskevitz 10 months ago
parent
commit
049bb33577
  1. 4
      ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/INode.cs
  2. 2
      ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs
  3. 18
      ICSharpCode.Decompiler/Semantics/Conversion.cs
  4. 10
      ICSharpCode.Decompiler/TypeSystem/Implementation/AbstractType.cs
  5. 8
      ICSharpCode.Decompiler/TypeSystem/Implementation/DecoratedType.cs
  6. 12
      ICSharpCode.Decompiler/TypeSystem/Implementation/GetMembersHelper.cs
  7. 12
      ICSharpCode.Decompiler/TypeSystem/Implementation/LocalFunctionMethod.cs
  8. 2
      ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs
  9. 2
      ICSharpCode.Decompiler/TypeSystem/Implementation/SimpleCompilation.cs
  10. 2
      ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedField.cs
  11. 8
      ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedMember.cs
  12. 14
      ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedMethod.cs
  13. 2
      ICSharpCode.Decompiler/TypeSystem/Implementation/UnknownType.cs
  14. 2
      ICSharpCode.Decompiler/TypeSystem/ModifiedType.cs
  15. 4
      ICSharpCode.Decompiler/TypeSystem/ParameterListComparer.cs
  16. 4
      ICSharpCode.Decompiler/TypeSystem/ParameterizedType.cs
  17. 4
      ICSharpCode.Decompiler/TypeSystem/SimpleTypeResolveContext.cs
  18. 6
      ICSharpCode.Decompiler/TypeSystem/VarArgInstanceMethod.cs

4
ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/INode.cs

@ -26,8 +26,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching
public interface INode public interface INode
{ {
Role Role { get; } Role Role { get; }
INode FirstChild { get; } INode? FirstChild { get; }
INode NextSibling { get; } INode? NextSibling { get; }
bool IsNull { get; } bool IsNull { get; }
bool DoMatch(INode other, Match match); bool DoMatch(INode other, Match match);

2
ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs

@ -437,7 +437,7 @@ namespace ICSharpCode.Decompiler.Documentation
} }
#endregion #endregion
public virtual void OnDeserialization(object sender) public virtual void OnDeserialization(object? sender)
{ {
cache = new XmlDocumentationCache(); cache = new XmlDocumentationCache();
} }

18
ICSharpCode.Decompiler/Semantics/Conversion.cs

@ -168,7 +168,7 @@ namespace ICSharpCode.Decompiler.Semantics
+ " conversion"; + " conversion";
} }
public override bool Equals(Conversion other) public override bool Equals(Conversion? other)
{ {
NumericOrEnumerationConversion? o = other as NumericOrEnumerationConversion; NumericOrEnumerationConversion? o = other as NumericOrEnumerationConversion;
return o != null && isImplicit == o.isImplicit && isLifted == o.isLifted && isEnumeration == o.isEnumeration; return o != null && isImplicit == o.isImplicit && isLifted == o.isLifted && isEnumeration == o.isEnumeration;
@ -335,7 +335,7 @@ namespace ICSharpCode.Decompiler.Semantics
get { return method; } get { return method; }
} }
public override bool Equals(Conversion other) public override bool Equals(Conversion? other)
{ {
UserDefinedConv? o = other as UserDefinedConv; UserDefinedConv? o = other as UserDefinedConv;
return o != null && isLifted == o.isLifted && isImplicit == o.isImplicit && isValid == o.isValid && method.Equals(o.method); return o != null && isLifted == o.isLifted && isImplicit == o.isImplicit && isValid == o.isValid && method.Equals(o.method);
@ -394,7 +394,7 @@ namespace ICSharpCode.Decompiler.Semantics
get { return method; } get { return method; }
} }
public override bool Equals(Conversion other) public override bool Equals(Conversion? other)
{ {
MethodGroupConv? o = other as MethodGroupConv; MethodGroupConv? o = other as MethodGroupConv;
return o != null && method.Equals(o.method); return o != null && method.Equals(o.method);
@ -419,7 +419,7 @@ namespace ICSharpCode.Decompiler.Semantics
this.IsImplicit = elementConversions.All(c => c.IsImplicit); this.IsImplicit = elementConversions.All(c => c.IsImplicit);
} }
public override bool Equals(Conversion other) public override bool Equals(Conversion? other)
{ {
return other is TupleConv o return other is TupleConv o
&& ElementConversions.SequenceEqual(o.ElementConversions); && ElementConversions.SequenceEqual(o.ElementConversions);
@ -534,14 +534,14 @@ namespace ICSharpCode.Decompiler.Semantics
/// <summary> /// <summary>
/// The conversion that is applied to the input before the user-defined conversion operator is invoked. /// The conversion that is applied to the input before the user-defined conversion operator is invoked.
/// </summary> /// </summary>
public virtual Conversion ConversionBeforeUserDefinedOperator { public virtual Conversion? ConversionBeforeUserDefinedOperator {
get { return null; } get { return null; }
} }
/// <summary> /// <summary>
/// The conversion that is applied to the result of the user-defined conversion operator. /// The conversion that is applied to the result of the user-defined conversion operator.
/// </summary> /// </summary>
public virtual Conversion ConversionAfterUserDefinedOperator { public virtual Conversion? ConversionAfterUserDefinedOperator {
get { return null; } get { return null; }
} }
@ -602,7 +602,7 @@ namespace ICSharpCode.Decompiler.Semantics
/// For user-defined conversions, this is the method being called. /// For user-defined conversions, this is the method being called.
/// For method-group conversions, this is the method that was chosen from the group. /// For method-group conversions, this is the method that was chosen from the group.
/// </summary> /// </summary>
public virtual IMethod Method { public virtual IMethod? Method {
get { return null; } get { return null; }
} }
@ -621,7 +621,7 @@ namespace ICSharpCode.Decompiler.Semantics
/// </summary> /// </summary>
public virtual ImmutableArray<Conversion> ElementConversions => default(ImmutableArray<Conversion>); public virtual ImmutableArray<Conversion> ElementConversions => default(ImmutableArray<Conversion>);
public override sealed bool Equals(object obj) public override sealed bool Equals(object? obj)
{ {
return Equals(obj as Conversion); return Equals(obj as Conversion);
} }
@ -631,7 +631,7 @@ namespace ICSharpCode.Decompiler.Semantics
return base.GetHashCode(); return base.GetHashCode();
} }
public virtual bool Equals(Conversion other) public virtual bool Equals(Conversion? other)
{ {
return this == other; return this == other;
} }

10
ICSharpCode.Decompiler/TypeSystem/Implementation/AbstractType.cs

@ -83,16 +83,16 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
get { return EmptyList<IType>.Instance; } get { return EmptyList<IType>.Instance; }
} }
public virtual IType DeclaringType { public virtual IType? DeclaringType {
get { return null; } get { return null; }
} }
public virtual ITypeDefinition GetDefinition() public virtual ITypeDefinition? GetDefinition()
{ {
return null; return null;
} }
public virtual ITypeDefinitionOrUnknown GetDefinitionOrUnknown() public virtual ITypeDefinitionOrUnknown? GetDefinitionOrUnknown()
{ {
return null; return null;
} }
@ -165,7 +165,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
return TypeParameterSubstitution.Identity; return TypeParameterSubstitution.Identity;
} }
public override sealed bool Equals(object obj) public override sealed bool Equals(object? obj)
{ {
return Equals(obj as IType); return Equals(obj as IType);
} }
@ -175,7 +175,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
return base.GetHashCode(); return base.GetHashCode();
} }
public virtual bool Equals(IType other) public virtual bool Equals(IType? other)
{ {
return this == other; // use reference equality by default return this == other; // use reference equality by default
} }

8
ICSharpCode.Decompiler/TypeSystem/Implementation/DecoratedType.cs

@ -22,7 +22,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
Nullability IType.Nullability => baseType.Nullability; Nullability IType.Nullability => baseType.Nullability;
public abstract IType ChangeNullability(Nullability nullability); public abstract IType ChangeNullability(Nullability nullability);
IType IType.DeclaringType => baseType.DeclaringType; IType? IType.DeclaringType => baseType.DeclaringType;
int IType.TypeParameterCount => baseType.TypeParameterCount; int IType.TypeParameterCount => baseType.TypeParameterCount;
@ -42,7 +42,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
public abstract IType AcceptVisitor(TypeVisitor visitor); public abstract IType AcceptVisitor(TypeVisitor visitor);
public abstract bool Equals(IType other); public abstract bool Equals(IType? other);
IEnumerable<IMethod> IType.GetAccessors(Predicate<IMethod>? filter, GetMemberOptions options) IEnumerable<IMethod> IType.GetAccessors(Predicate<IMethod>? filter, GetMemberOptions options)
{ {
@ -54,12 +54,12 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
return baseType.GetConstructors(filter, options); return baseType.GetConstructors(filter, options);
} }
ITypeDefinition IType.GetDefinition() ITypeDefinition? IType.GetDefinition()
{ {
return baseType.GetDefinition(); return baseType.GetDefinition();
} }
ITypeDefinitionOrUnknown IType.GetDefinitionOrUnknown() ITypeDefinitionOrUnknown? IType.GetDefinitionOrUnknown()
{ {
return baseType.GetDefinitionOrUnknown(); return baseType.GetDefinitionOrUnknown();
} }

12
ICSharpCode.Decompiler/TypeSystem/Implementation/GetMembersHelper.cs

@ -98,12 +98,12 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
#endregion #endregion
#region GetMethods #region GetMethods
public static IEnumerable<IMethod> GetMethods(IType type, Predicate<IMethod> filter, GetMemberOptions options) public static IEnumerable<IMethod> GetMethods(IType type, Predicate<IMethod>? filter, GetMemberOptions options)
{ {
return GetMethods(type, null, filter, options); return GetMethods(type, null, filter, options);
} }
public static IEnumerable<IMethod> GetMethods(IType type, IReadOnlyList<IType> typeArguments, Predicate<IMethod> filter, GetMemberOptions options) public static IEnumerable<IMethod> GetMethods(IType type, IReadOnlyList<IType>? typeArguments, Predicate<IMethod>? filter, GetMemberOptions options)
{ {
if (typeArguments != null && typeArguments.Count > 0) if (typeArguments != null && typeArguments.Count > 0)
{ {
@ -127,7 +127,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
const GetMemberOptions declaredMembers = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions; const GetMemberOptions declaredMembers = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions;
static IEnumerable<IMethod> GetMethodsImpl(IType baseType, IReadOnlyList<IType>? methodTypeArguments, Predicate<IMethod> filter, GetMemberOptions options) static IEnumerable<IMethod> GetMethodsImpl(IType baseType, IReadOnlyList<IType>? methodTypeArguments, Predicate<IMethod>? filter, GetMemberOptions options)
{ {
IEnumerable<IMethod> declaredMethods = baseType.GetMethods(filter, options | declaredMembers); IEnumerable<IMethod> declaredMethods = baseType.GetMethods(filter, options | declaredMembers);
@ -164,7 +164,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
#endregion #endregion
#region GetAccessors #region GetAccessors
public static IEnumerable<IMethod> GetAccessors(IType type, Predicate<IMethod> filter, GetMemberOptions options) public static IEnumerable<IMethod> GetAccessors(IType type, Predicate<IMethod>? filter, GetMemberOptions options)
{ {
if ((options & GetMemberOptions.IgnoreInheritedMembers) == GetMemberOptions.IgnoreInheritedMembers) if ((options & GetMemberOptions.IgnoreInheritedMembers) == GetMemberOptions.IgnoreInheritedMembers)
{ {
@ -323,7 +323,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
#endregion #endregion
#region GetMembers #region GetMembers
public static IEnumerable<IMember> GetMembers(IType type, Predicate<IMember> filter, GetMemberOptions options) public static IEnumerable<IMember> GetMembers(IType type, Predicate<IMember>? filter, GetMemberOptions options)
{ {
if ((options & GetMemberOptions.IgnoreInheritedMembers) == GetMemberOptions.IgnoreInheritedMembers) if ((options & GetMemberOptions.IgnoreInheritedMembers) == GetMemberOptions.IgnoreInheritedMembers)
{ {
@ -335,7 +335,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
} }
} }
static IEnumerable<IMember> GetMembersImpl(IType baseType, Predicate<IMember> filter, GetMemberOptions options) static IEnumerable<IMember> GetMembersImpl(IType baseType, Predicate<IMember>? filter, GetMemberOptions options)
{ {
foreach (var m in GetMethodsImpl(baseType, null, filter, options)) foreach (var m in GetMethodsImpl(baseType, null, filter, options))
yield return m; yield return m;

12
ICSharpCode.Decompiler/TypeSystem/Implementation/LocalFunctionMethod.cs

@ -43,7 +43,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
this.NumberOfCompilerGeneratedTypeParameters = numberOfCompilerGeneratedTypeParameters; this.NumberOfCompilerGeneratedTypeParameters = numberOfCompilerGeneratedTypeParameters;
} }
public bool Equals(IMember obj, TypeVisitor typeNormalization) public bool Equals(IMember? obj, TypeVisitor typeNormalization)
{ {
if (!(obj is LocalFunctionMethod other)) if (!(obj is LocalFunctionMethod other))
return false; return false;
@ -53,7 +53,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
&& IsStaticLocalFunction == other.IsStaticLocalFunction; && IsStaticLocalFunction == other.IsStaticLocalFunction;
} }
public override bool Equals(object obj) public override bool Equals(object? obj)
{ {
if (!(obj is LocalFunctionMethod other)) if (!(obj is LocalFunctionMethod other))
return false; return false;
@ -108,7 +108,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
public bool IsOperator => baseMethod.IsOperator; public bool IsOperator => baseMethod.IsOperator;
public bool HasBody => baseMethod.HasBody; public bool HasBody => baseMethod.HasBody;
public bool IsAccessor => baseMethod.IsAccessor; public bool IsAccessor => baseMethod.IsAccessor;
public IMember AccessorOwner => baseMethod.AccessorOwner; public IMember? AccessorOwner => baseMethod.AccessorOwner;
public MethodSemanticsAttributes AccessorKind => baseMethod.AccessorKind; public MethodSemanticsAttributes AccessorKind => baseMethod.AccessorKind;
public IMethod ReducedFrom => baseMethod; public IMethod ReducedFrom => baseMethod;
@ -141,12 +141,12 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
public System.Reflection.Metadata.EntityHandle MetadataToken => baseMethod.MetadataToken; public System.Reflection.Metadata.EntityHandle MetadataToken => baseMethod.MetadataToken;
public SymbolKind SymbolKind => baseMethod.SymbolKind; public SymbolKind SymbolKind => baseMethod.SymbolKind;
public ITypeDefinition DeclaringTypeDefinition => baseMethod.DeclaringTypeDefinition; public ITypeDefinition? DeclaringTypeDefinition => baseMethod.DeclaringTypeDefinition;
public IType DeclaringType => baseMethod.DeclaringType; public IType DeclaringType => baseMethod.DeclaringType;
public IModule ParentModule => baseMethod.ParentModule; public IModule? ParentModule => baseMethod.ParentModule;
IEnumerable<IAttribute> IEntity.GetAttributes() => baseMethod.GetAttributes(); IEnumerable<IAttribute> IEntity.GetAttributes() => baseMethod.GetAttributes();
bool IEntity.HasAttribute(KnownAttribute attribute) => baseMethod.HasAttribute(attribute); bool IEntity.HasAttribute(KnownAttribute attribute) => baseMethod.HasAttribute(attribute);
IAttribute IEntity.GetAttribute(KnownAttribute attribute) => baseMethod.GetAttribute(attribute); IAttribute? IEntity.GetAttribute(KnownAttribute attribute) => baseMethod.GetAttribute(attribute);
IEnumerable<IAttribute> IMethod.GetReturnTypeAttributes() => baseMethod.GetReturnTypeAttributes(); IEnumerable<IAttribute> IMethod.GetReturnTypeAttributes() => baseMethod.GetReturnTypeAttributes();
bool IMethod.ReturnTypeIsRefReadOnly => baseMethod.ReturnTypeIsRefReadOnly; bool IMethod.ReturnTypeIsRefReadOnly => baseMethod.ReturnTypeIsRefReadOnly;
bool IMethod.ThisIsRefReadOnly => baseMethod.ThisIsRefReadOnly; bool IMethod.ThisIsRefReadOnly => baseMethod.ThisIsRefReadOnly;

2
ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs

@ -476,7 +476,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
return b.HasAttribute(metadata, def.GetCustomAttributes(), attribute, symbolKind); return b.HasAttribute(metadata, def.GetCustomAttributes(), attribute, symbolKind);
} }
public IAttribute GetAttribute(KnownAttribute attribute) public IAttribute? GetAttribute(KnownAttribute attribute)
{ {
if (!attribute.IsCustomAttribute()) if (!attribute.IsCustomAttribute())
{ {

2
ICSharpCode.Decompiler/TypeSystem/Implementation/SimpleCompilation.cs

@ -140,7 +140,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
get { return cacheManager; } get { return cacheManager; }
} }
public virtual INamespace GetNamespaceForExternAlias(string alias) public virtual INamespace? GetNamespaceForExternAlias(string? alias)
{ {
if (string.IsNullOrEmpty(alias)) if (string.IsNullOrEmpty(alias))
return this.RootNamespace; return this.RootNamespace;

2
ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedField.cs

@ -57,7 +57,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
get { return fieldDefinition.IsConst; } get { return fieldDefinition.IsConst; }
} }
public object GetConstantValue(bool throwOnInvalidMetadata) public object? GetConstantValue(bool throwOnInvalidMetadata)
{ {
return fieldDefinition.GetConstantValue(throwOnInvalidMetadata); return fieldDefinition.GetConstantValue(throwOnInvalidMetadata);
} }

8
ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedMember.cs

@ -157,7 +157,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
get { return baseMember.SymbolKind; } get { return baseMember.SymbolKind; }
} }
public ITypeDefinition DeclaringTypeDefinition { public ITypeDefinition? DeclaringTypeDefinition {
get { return baseMember.DeclaringTypeDefinition; } get { return baseMember.DeclaringTypeDefinition; }
} }
@ -214,7 +214,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
get { return baseMember.Compilation; } get { return baseMember.Compilation; }
} }
public IModule ParentModule { public IModule? ParentModule {
get { return baseMember.ParentModule; } get { return baseMember.ParentModule; }
} }
@ -223,7 +223,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
return baseMember.Specialize(TypeParameterSubstitution.Compose(newSubstitution, this.substitution)); return baseMember.Specialize(TypeParameterSubstitution.Compose(newSubstitution, this.substitution));
} }
public virtual bool Equals(IMember obj, TypeVisitor typeNormalization) public virtual bool Equals(IMember? obj, TypeVisitor typeNormalization)
{ {
SpecializedMember? other = obj as SpecializedMember; SpecializedMember? other = obj as SpecializedMember;
if (other == null) if (other == null)
@ -232,7 +232,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
&& this.substitution.Equals(other.substitution, typeNormalization); && this.substitution.Equals(other.substitution, typeNormalization);
} }
public override bool Equals(object obj) public override bool Equals(object? obj)
{ {
SpecializedMember? other = obj as SpecializedMember; SpecializedMember? other = obj as SpecializedMember;
if (other == null) if (other == null)

14
ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedMethod.cs

@ -146,13 +146,13 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
public MethodSemanticsAttributes AccessorKind => methodDefinition.AccessorKind; public MethodSemanticsAttributes AccessorKind => methodDefinition.AccessorKind;
public IMethod ReducedFrom { public IMethod? ReducedFrom {
get { return null; } get { return null; }
} }
IMember accessorOwner; IMember? accessorOwner;
public IMember AccessorOwner { public IMember? AccessorOwner {
get { get {
var result = LazyInit.VolatileRead(ref accessorOwner); var result = LazyInit.VolatileRead(ref accessorOwner);
if (result != null) if (result != null)
@ -173,7 +173,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
} }
} }
public override bool Equals(IMember obj, TypeVisitor typeNormalization) public override bool Equals(IMember? obj, TypeVisitor typeNormalization)
{ {
SpecializedMethod? other = obj as SpecializedMethod; SpecializedMethod? other = obj as SpecializedMethod;
if (other == null) if (other == null)
@ -182,7 +182,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
&& this.substitutionWithoutSpecializedTypeParameters.Equals(other.substitutionWithoutSpecializedTypeParameters, typeNormalization); && this.substitutionWithoutSpecializedTypeParameters.Equals(other.substitutionWithoutSpecializedTypeParameters, typeNormalization);
} }
public override bool Equals(object obj) public override bool Equals(object? obj)
{ {
SpecializedMethod? other = obj as SpecializedMethod; SpecializedMethod? other = obj as SpecializedMethod;
if (other == null) if (other == null)
@ -267,11 +267,11 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
return baseTp.GetHashCode() ^ this.Owner.GetHashCode(); return baseTp.GetHashCode() ^ this.Owner.GetHashCode();
} }
public override bool Equals(IType other) public override bool Equals(IType? other)
{ {
// Compare the owner, not the substitution, because the substitution may contain this specialized type parameter recursively // Compare the owner, not the substitution, because the substitution may contain this specialized type parameter recursively
SpecializedTypeParameter? o = other as SpecializedTypeParameter; SpecializedTypeParameter? o = other as SpecializedTypeParameter;
return o != null && baseTp.Equals(o.baseTp) && this.Owner.Equals(o.Owner); return o != null && baseTp.Equals(o.baseTp) && this.Owner?.Equals(o.Owner) == true;
} }
public override bool HasValueTypeConstraint => baseTp.HasValueTypeConstraint; public override bool HasValueTypeConstraint => baseTp.HasValueTypeConstraint;

2
ICSharpCode.Decompiler/TypeSystem/Implementation/UnknownType.cs

@ -122,7 +122,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
return (namespaceKnown ? 812571 : 12651) ^ fullTypeName.GetHashCode(); return (namespaceKnown ? 812571 : 12651) ^ fullTypeName.GetHashCode();
} }
public override bool Equals(IType other) public override bool Equals(IType? other)
{ {
UnknownType? o = other as UnknownType; UnknownType? o = other as UnknownType;
if (o == null) if (o == null)

2
ICSharpCode.Decompiler/TypeSystem/ModifiedType.cs

@ -132,7 +132,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
return visitor.VisitModOpt(this); return visitor.VisitModOpt(this);
} }
public override bool Equals(IType other) public override bool Equals(IType? other)
{ {
return other is ModifiedType o && kind == o.kind && modifier.Equals(o.modifier) && elementType.Equals(o.elementType); return other is ModifiedType o && kind == o.kind && modifier.Equals(o.modifier) && elementType.Equals(o.elementType);
} }

4
ICSharpCode.Decompiler/TypeSystem/ParameterListComparer.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
}; };
} }
public bool Equals(IReadOnlyList<IParameter> x, IReadOnlyList<IParameter> y) public bool Equals(IReadOnlyList<IParameter>? x, IReadOnlyList<IParameter>? y)
{ {
if (x == y) if (x == y)
return true; return true;
@ -125,7 +125,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
/// </summary> /// </summary>
public static readonly SignatureComparer Ordinal = new SignatureComparer(StringComparer.Ordinal); public static readonly SignatureComparer Ordinal = new SignatureComparer(StringComparer.Ordinal);
public bool Equals(IMember x, IMember y) public bool Equals(IMember? x, IMember? y)
{ {
if (x == y) if (x == y)
return true; return true;

4
ICSharpCode.Decompiler/TypeSystem/ParameterizedType.cs

@ -291,12 +291,12 @@ namespace ICSharpCode.Decompiler.TypeSystem
return GetMembersHelper.GetAccessors(this, filter, options); return GetMembersHelper.GetAccessors(this, filter, options);
} }
public override bool Equals(object obj) public override bool Equals(object? obj)
{ {
return Equals(obj as IType); return Equals(obj as IType);
} }
public bool Equals(IType other) public bool Equals(IType? other)
{ {
if (this == other) if (this == other)
return true; return true;

4
ICSharpCode.Decompiler/TypeSystem/SimpleTypeResolveContext.cs

@ -79,12 +79,12 @@ namespace ICSharpCode.Decompiler.TypeSystem
get { return currentMember; } get { return currentMember; }
} }
public ITypeResolveContext WithCurrentTypeDefinition(ITypeDefinition typeDefinition) public ITypeResolveContext WithCurrentTypeDefinition(ITypeDefinition? typeDefinition)
{ {
return new SimpleTypeResolveContext(compilation, currentModule, typeDefinition, currentMember); return new SimpleTypeResolveContext(compilation, currentModule, typeDefinition, currentMember);
} }
public ITypeResolveContext WithCurrentMember(IMember member) public ITypeResolveContext WithCurrentMember(IMember? member)
{ {
return new SimpleTypeResolveContext(compilation, currentModule, currentTypeDefinition, member); return new SimpleTypeResolveContext(compilation, currentModule, currentTypeDefinition, member);
} }

6
ICSharpCode.Decompiler/TypeSystem/VarArgInstanceMethod.cs

@ -58,7 +58,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
get { return parameters; } get { return parameters; }
} }
public override bool Equals(object obj) public override bool Equals(object? obj)
{ {
VarArgInstanceMethod? other = obj as VarArgInstanceMethod; VarArgInstanceMethod? other = obj as VarArgInstanceMethod;
return other != null && baseMethod.Equals(other.baseMethod); return other != null && baseMethod.Equals(other.baseMethod);
@ -69,7 +69,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
return baseMethod.GetHashCode(); return baseMethod.GetHashCode();
} }
public bool Equals(IMember obj, TypeVisitor typeNormalization) public bool Equals(IMember? obj, TypeVisitor typeNormalization)
{ {
VarArgInstanceMethod? other = obj as VarArgInstanceMethod; VarArgInstanceMethod? other = obj as VarArgInstanceMethod;
return other != null && baseMethod.Equals(other.baseMethod, typeNormalization); return other != null && baseMethod.Equals(other.baseMethod, typeNormalization);
@ -119,7 +119,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
IEnumerable<IAttribute> IEntity.GetAttributes() => baseMethod.GetAttributes(); IEnumerable<IAttribute> IEntity.GetAttributes() => baseMethod.GetAttributes();
bool IEntity.HasAttribute(KnownAttribute attribute) => baseMethod.HasAttribute(attribute); bool IEntity.HasAttribute(KnownAttribute attribute) => baseMethod.HasAttribute(attribute);
IAttribute IEntity.GetAttribute(KnownAttribute attribute) => baseMethod.GetAttribute(attribute); IAttribute? IEntity.GetAttribute(KnownAttribute attribute) => baseMethod.GetAttribute(attribute);
IEnumerable<IAttribute> IMethod.GetReturnTypeAttributes() => baseMethod.GetReturnTypeAttributes(); IEnumerable<IAttribute> IMethod.GetReturnTypeAttributes() => baseMethod.GetReturnTypeAttributes();
bool IMethod.ReturnTypeIsRefReadOnly => baseMethod.ReturnTypeIsRefReadOnly; bool IMethod.ReturnTypeIsRefReadOnly => baseMethod.ReturnTypeIsRefReadOnly;

Loading…
Cancel
Save