From 049bb33577361d2ab5a7de776caf0c54678807e4 Mon Sep 17 00:00:00 2001 From: apmoskevitz Date: Fri, 20 Sep 2024 14:35:07 -0400 Subject: [PATCH] focus on CS8768 and CS8767 --- .../CSharp/Syntax/PatternMatching/INode.cs | 4 ++-- .../Documentation/XmlDocumentationProvider.cs | 2 +- ICSharpCode.Decompiler/Semantics/Conversion.cs | 18 +++++++++--------- .../TypeSystem/Implementation/AbstractType.cs | 10 +++++----- .../TypeSystem/Implementation/DecoratedType.cs | 8 ++++---- .../Implementation/GetMembersHelper.cs | 12 ++++++------ .../Implementation/LocalFunctionMethod.cs | 12 ++++++------ .../Implementation/MetadataMethod.cs | 2 +- .../Implementation/SimpleCompilation.cs | 2 +- .../Implementation/SpecializedField.cs | 2 +- .../Implementation/SpecializedMember.cs | 8 ++++---- .../Implementation/SpecializedMethod.cs | 14 +++++++------- .../TypeSystem/Implementation/UnknownType.cs | 2 +- .../TypeSystem/ModifiedType.cs | 2 +- .../TypeSystem/ParameterListComparer.cs | 4 ++-- .../TypeSystem/ParameterizedType.cs | 4 ++-- .../TypeSystem/SimpleTypeResolveContext.cs | 4 ++-- .../TypeSystem/VarArgInstanceMethod.cs | 6 +++--- 18 files changed, 58 insertions(+), 58 deletions(-) diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/INode.cs b/ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/INode.cs index d1e3fc6e7..327204e3e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/INode.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/INode.cs @@ -26,8 +26,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching public interface INode { Role Role { get; } - INode FirstChild { get; } - INode NextSibling { get; } + INode? FirstChild { get; } + INode? NextSibling { get; } bool IsNull { get; } bool DoMatch(INode other, Match match); diff --git a/ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs b/ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs index f2b4b2ad9..af9bf21f7 100644 --- a/ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs +++ b/ICSharpCode.Decompiler/Documentation/XmlDocumentationProvider.cs @@ -437,7 +437,7 @@ namespace ICSharpCode.Decompiler.Documentation } #endregion - public virtual void OnDeserialization(object sender) + public virtual void OnDeserialization(object? sender) { cache = new XmlDocumentationCache(); } diff --git a/ICSharpCode.Decompiler/Semantics/Conversion.cs b/ICSharpCode.Decompiler/Semantics/Conversion.cs index 792b49bb0..1d5248527 100644 --- a/ICSharpCode.Decompiler/Semantics/Conversion.cs +++ b/ICSharpCode.Decompiler/Semantics/Conversion.cs @@ -168,7 +168,7 @@ namespace ICSharpCode.Decompiler.Semantics + " conversion"; } - public override bool Equals(Conversion other) + public override bool Equals(Conversion? other) { NumericOrEnumerationConversion? o = other as NumericOrEnumerationConversion; return o != null && isImplicit == o.isImplicit && isLifted == o.isLifted && isEnumeration == o.isEnumeration; @@ -335,7 +335,7 @@ namespace ICSharpCode.Decompiler.Semantics get { return method; } } - public override bool Equals(Conversion other) + public override bool Equals(Conversion? other) { UserDefinedConv? o = other as UserDefinedConv; 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; } } - public override bool Equals(Conversion other) + public override bool Equals(Conversion? other) { MethodGroupConv? o = other as MethodGroupConv; return o != null && method.Equals(o.method); @@ -419,7 +419,7 @@ namespace ICSharpCode.Decompiler.Semantics this.IsImplicit = elementConversions.All(c => c.IsImplicit); } - public override bool Equals(Conversion other) + public override bool Equals(Conversion? other) { return other is TupleConv o && ElementConversions.SequenceEqual(o.ElementConversions); @@ -534,14 +534,14 @@ namespace ICSharpCode.Decompiler.Semantics /// /// The conversion that is applied to the input before the user-defined conversion operator is invoked. /// - public virtual Conversion ConversionBeforeUserDefinedOperator { + public virtual Conversion? ConversionBeforeUserDefinedOperator { get { return null; } } /// /// The conversion that is applied to the result of the user-defined conversion operator. /// - public virtual Conversion ConversionAfterUserDefinedOperator { + public virtual Conversion? ConversionAfterUserDefinedOperator { get { return null; } } @@ -602,7 +602,7 @@ namespace ICSharpCode.Decompiler.Semantics /// For user-defined conversions, this is the method being called. /// For method-group conversions, this is the method that was chosen from the group. /// - public virtual IMethod Method { + public virtual IMethod? Method { get { return null; } } @@ -621,7 +621,7 @@ namespace ICSharpCode.Decompiler.Semantics /// public virtual ImmutableArray ElementConversions => default(ImmutableArray); - public override sealed bool Equals(object obj) + public override sealed bool Equals(object? obj) { return Equals(obj as Conversion); } @@ -631,7 +631,7 @@ namespace ICSharpCode.Decompiler.Semantics return base.GetHashCode(); } - public virtual bool Equals(Conversion other) + public virtual bool Equals(Conversion? other) { return this == other; } diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/AbstractType.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/AbstractType.cs index c69467999..fd9e25ace 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/AbstractType.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/AbstractType.cs @@ -83,16 +83,16 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation get { return EmptyList.Instance; } } - public virtual IType DeclaringType { + public virtual IType? DeclaringType { get { return null; } } - public virtual ITypeDefinition GetDefinition() + public virtual ITypeDefinition? GetDefinition() { return null; } - public virtual ITypeDefinitionOrUnknown GetDefinitionOrUnknown() + public virtual ITypeDefinitionOrUnknown? GetDefinitionOrUnknown() { return null; } @@ -165,7 +165,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation return TypeParameterSubstitution.Identity; } - public override sealed bool Equals(object obj) + public override sealed bool Equals(object? obj) { return Equals(obj as IType); } @@ -175,7 +175,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation return base.GetHashCode(); } - public virtual bool Equals(IType other) + public virtual bool Equals(IType? other) { return this == other; // use reference equality by default } diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/DecoratedType.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/DecoratedType.cs index 5e9f1a587..a3d25f822 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/DecoratedType.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/DecoratedType.cs @@ -22,7 +22,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation Nullability IType.Nullability => baseType.Nullability; public abstract IType ChangeNullability(Nullability nullability); - IType IType.DeclaringType => baseType.DeclaringType; + IType? IType.DeclaringType => baseType.DeclaringType; int IType.TypeParameterCount => baseType.TypeParameterCount; @@ -42,7 +42,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation public abstract IType AcceptVisitor(TypeVisitor visitor); - public abstract bool Equals(IType other); + public abstract bool Equals(IType? other); IEnumerable IType.GetAccessors(Predicate? filter, GetMemberOptions options) { @@ -54,12 +54,12 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation return baseType.GetConstructors(filter, options); } - ITypeDefinition IType.GetDefinition() + ITypeDefinition? IType.GetDefinition() { return baseType.GetDefinition(); } - ITypeDefinitionOrUnknown IType.GetDefinitionOrUnknown() + ITypeDefinitionOrUnknown? IType.GetDefinitionOrUnknown() { return baseType.GetDefinitionOrUnknown(); } diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/GetMembersHelper.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/GetMembersHelper.cs index 2ce8d45df..285403b71 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/GetMembersHelper.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/GetMembersHelper.cs @@ -98,12 +98,12 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation #endregion #region GetMethods - public static IEnumerable GetMethods(IType type, Predicate filter, GetMemberOptions options) + public static IEnumerable GetMethods(IType type, Predicate? filter, GetMemberOptions options) { return GetMethods(type, null, filter, options); } - public static IEnumerable GetMethods(IType type, IReadOnlyList typeArguments, Predicate filter, GetMemberOptions options) + public static IEnumerable GetMethods(IType type, IReadOnlyList? typeArguments, Predicate? filter, GetMemberOptions options) { if (typeArguments != null && typeArguments.Count > 0) { @@ -127,7 +127,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation const GetMemberOptions declaredMembers = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions; - static IEnumerable GetMethodsImpl(IType baseType, IReadOnlyList? methodTypeArguments, Predicate filter, GetMemberOptions options) + static IEnumerable GetMethodsImpl(IType baseType, IReadOnlyList? methodTypeArguments, Predicate? filter, GetMemberOptions options) { IEnumerable declaredMethods = baseType.GetMethods(filter, options | declaredMembers); @@ -164,7 +164,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation #endregion #region GetAccessors - public static IEnumerable GetAccessors(IType type, Predicate filter, GetMemberOptions options) + public static IEnumerable GetAccessors(IType type, Predicate? filter, GetMemberOptions options) { if ((options & GetMemberOptions.IgnoreInheritedMembers) == GetMemberOptions.IgnoreInheritedMembers) { @@ -323,7 +323,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation #endregion #region GetMembers - public static IEnumerable GetMembers(IType type, Predicate filter, GetMemberOptions options) + public static IEnumerable GetMembers(IType type, Predicate? filter, GetMemberOptions options) { if ((options & GetMemberOptions.IgnoreInheritedMembers) == GetMemberOptions.IgnoreInheritedMembers) { @@ -335,7 +335,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation } } - static IEnumerable GetMembersImpl(IType baseType, Predicate filter, GetMemberOptions options) + static IEnumerable GetMembersImpl(IType baseType, Predicate? filter, GetMemberOptions options) { foreach (var m in GetMethodsImpl(baseType, null, filter, options)) yield return m; diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/LocalFunctionMethod.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/LocalFunctionMethod.cs index 30d7aa60b..b63f220b5 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/LocalFunctionMethod.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/LocalFunctionMethod.cs @@ -43,7 +43,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation this.NumberOfCompilerGeneratedTypeParameters = numberOfCompilerGeneratedTypeParameters; } - public bool Equals(IMember obj, TypeVisitor typeNormalization) + public bool Equals(IMember? obj, TypeVisitor typeNormalization) { if (!(obj is LocalFunctionMethod other)) return false; @@ -53,7 +53,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation && IsStaticLocalFunction == other.IsStaticLocalFunction; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (!(obj is LocalFunctionMethod other)) return false; @@ -108,7 +108,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation public bool IsOperator => baseMethod.IsOperator; public bool HasBody => baseMethod.HasBody; public bool IsAccessor => baseMethod.IsAccessor; - public IMember AccessorOwner => baseMethod.AccessorOwner; + public IMember? AccessorOwner => baseMethod.AccessorOwner; public MethodSemanticsAttributes AccessorKind => baseMethod.AccessorKind; public IMethod ReducedFrom => baseMethod; @@ -141,12 +141,12 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation public System.Reflection.Metadata.EntityHandle MetadataToken => baseMethod.MetadataToken; public SymbolKind SymbolKind => baseMethod.SymbolKind; - public ITypeDefinition DeclaringTypeDefinition => baseMethod.DeclaringTypeDefinition; + public ITypeDefinition? DeclaringTypeDefinition => baseMethod.DeclaringTypeDefinition; public IType DeclaringType => baseMethod.DeclaringType; - public IModule ParentModule => baseMethod.ParentModule; + public IModule? ParentModule => baseMethod.ParentModule; IEnumerable IEntity.GetAttributes() => baseMethod.GetAttributes(); 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 IMethod.GetReturnTypeAttributes() => baseMethod.GetReturnTypeAttributes(); bool IMethod.ReturnTypeIsRefReadOnly => baseMethod.ReturnTypeIsRefReadOnly; bool IMethod.ThisIsRefReadOnly => baseMethod.ThisIsRefReadOnly; diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs index d81e86d3d..8bdb5c265 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs @@ -476,7 +476,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation return b.HasAttribute(metadata, def.GetCustomAttributes(), attribute, symbolKind); } - public IAttribute GetAttribute(KnownAttribute attribute) + public IAttribute? GetAttribute(KnownAttribute attribute) { if (!attribute.IsCustomAttribute()) { diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/SimpleCompilation.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/SimpleCompilation.cs index ade71cf71..1257c0b66 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/SimpleCompilation.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/SimpleCompilation.cs @@ -140,7 +140,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation get { return cacheManager; } } - public virtual INamespace GetNamespaceForExternAlias(string alias) + public virtual INamespace? GetNamespaceForExternAlias(string? alias) { if (string.IsNullOrEmpty(alias)) return this.RootNamespace; diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedField.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedField.cs index fe4dc9ccc..163660313 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedField.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedField.cs @@ -57,7 +57,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation get { return fieldDefinition.IsConst; } } - public object GetConstantValue(bool throwOnInvalidMetadata) + public object? GetConstantValue(bool throwOnInvalidMetadata) { return fieldDefinition.GetConstantValue(throwOnInvalidMetadata); } diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedMember.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedMember.cs index ba4e5dfbf..0f8f55734 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedMember.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedMember.cs @@ -157,7 +157,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation get { return baseMember.SymbolKind; } } - public ITypeDefinition DeclaringTypeDefinition { + public ITypeDefinition? DeclaringTypeDefinition { get { return baseMember.DeclaringTypeDefinition; } } @@ -214,7 +214,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation get { return baseMember.Compilation; } } - public IModule ParentModule { + public IModule? ParentModule { get { return baseMember.ParentModule; } } @@ -223,7 +223,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation 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; if (other == null) @@ -232,7 +232,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation && this.substitution.Equals(other.substitution, typeNormalization); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { SpecializedMember? other = obj as SpecializedMember; if (other == null) diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedMethod.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedMethod.cs index 623b59a08..774efea03 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedMethod.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/SpecializedMethod.cs @@ -146,13 +146,13 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation public MethodSemanticsAttributes AccessorKind => methodDefinition.AccessorKind; - public IMethod ReducedFrom { + public IMethod? ReducedFrom { get { return null; } } - IMember accessorOwner; + IMember? accessorOwner; - public IMember AccessorOwner { + public IMember? AccessorOwner { get { var result = LazyInit.VolatileRead(ref accessorOwner); 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; if (other == null) @@ -182,7 +182,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation && this.substitutionWithoutSpecializedTypeParameters.Equals(other.substitutionWithoutSpecializedTypeParameters, typeNormalization); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { SpecializedMethod? other = obj as SpecializedMethod; if (other == null) @@ -267,11 +267,11 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation 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 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; diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/UnknownType.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/UnknownType.cs index 756bfb258..88e0b57a6 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/UnknownType.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/UnknownType.cs @@ -122,7 +122,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation return (namespaceKnown ? 812571 : 12651) ^ fullTypeName.GetHashCode(); } - public override bool Equals(IType other) + public override bool Equals(IType? other) { UnknownType? o = other as UnknownType; if (o == null) diff --git a/ICSharpCode.Decompiler/TypeSystem/ModifiedType.cs b/ICSharpCode.Decompiler/TypeSystem/ModifiedType.cs index 5959cded9..cbe73db36 100644 --- a/ICSharpCode.Decompiler/TypeSystem/ModifiedType.cs +++ b/ICSharpCode.Decompiler/TypeSystem/ModifiedType.cs @@ -132,7 +132,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation 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); } diff --git a/ICSharpCode.Decompiler/TypeSystem/ParameterListComparer.cs b/ICSharpCode.Decompiler/TypeSystem/ParameterListComparer.cs index dc91fd6bb..684631440 100644 --- a/ICSharpCode.Decompiler/TypeSystem/ParameterListComparer.cs +++ b/ICSharpCode.Decompiler/TypeSystem/ParameterListComparer.cs @@ -52,7 +52,7 @@ namespace ICSharpCode.Decompiler.TypeSystem }; } - public bool Equals(IReadOnlyList x, IReadOnlyList y) + public bool Equals(IReadOnlyList? x, IReadOnlyList? y) { if (x == y) return true; @@ -125,7 +125,7 @@ namespace ICSharpCode.Decompiler.TypeSystem /// 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) return true; diff --git a/ICSharpCode.Decompiler/TypeSystem/ParameterizedType.cs b/ICSharpCode.Decompiler/TypeSystem/ParameterizedType.cs index 693c1bf2b..537440a1b 100644 --- a/ICSharpCode.Decompiler/TypeSystem/ParameterizedType.cs +++ b/ICSharpCode.Decompiler/TypeSystem/ParameterizedType.cs @@ -291,12 +291,12 @@ namespace ICSharpCode.Decompiler.TypeSystem return GetMembersHelper.GetAccessors(this, filter, options); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { return Equals(obj as IType); } - public bool Equals(IType other) + public bool Equals(IType? other) { if (this == other) return true; diff --git a/ICSharpCode.Decompiler/TypeSystem/SimpleTypeResolveContext.cs b/ICSharpCode.Decompiler/TypeSystem/SimpleTypeResolveContext.cs index 782de8da1..5356f8d1d 100644 --- a/ICSharpCode.Decompiler/TypeSystem/SimpleTypeResolveContext.cs +++ b/ICSharpCode.Decompiler/TypeSystem/SimpleTypeResolveContext.cs @@ -79,12 +79,12 @@ namespace ICSharpCode.Decompiler.TypeSystem get { return currentMember; } } - public ITypeResolveContext WithCurrentTypeDefinition(ITypeDefinition typeDefinition) + public ITypeResolveContext WithCurrentTypeDefinition(ITypeDefinition? typeDefinition) { return new SimpleTypeResolveContext(compilation, currentModule, typeDefinition, currentMember); } - public ITypeResolveContext WithCurrentMember(IMember member) + public ITypeResolveContext WithCurrentMember(IMember? member) { return new SimpleTypeResolveContext(compilation, currentModule, currentTypeDefinition, member); } diff --git a/ICSharpCode.Decompiler/TypeSystem/VarArgInstanceMethod.cs b/ICSharpCode.Decompiler/TypeSystem/VarArgInstanceMethod.cs index e48653d42..efeb56191 100644 --- a/ICSharpCode.Decompiler/TypeSystem/VarArgInstanceMethod.cs +++ b/ICSharpCode.Decompiler/TypeSystem/VarArgInstanceMethod.cs @@ -58,7 +58,7 @@ namespace ICSharpCode.Decompiler.TypeSystem get { return parameters; } } - public override bool Equals(object obj) + public override bool Equals(object? obj) { VarArgInstanceMethod? other = obj as VarArgInstanceMethod; return other != null && baseMethod.Equals(other.baseMethod); @@ -69,7 +69,7 @@ namespace ICSharpCode.Decompiler.TypeSystem return baseMethod.GetHashCode(); } - public bool Equals(IMember obj, TypeVisitor typeNormalization) + public bool Equals(IMember? obj, TypeVisitor typeNormalization) { VarArgInstanceMethod? other = obj as VarArgInstanceMethod; return other != null && baseMethod.Equals(other.baseMethod, typeNormalization); @@ -119,7 +119,7 @@ namespace ICSharpCode.Decompiler.TypeSystem IEnumerable IEntity.GetAttributes() => baseMethod.GetAttributes(); 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 IMethod.GetReturnTypeAttributes() => baseMethod.GetReturnTypeAttributes(); bool IMethod.ReturnTypeIsRefReadOnly => baseMethod.ReturnTypeIsRefReadOnly;