Browse Source

Fixes markup warnings (#6525)

* fixes: suppress warning  CS0659  Type overrides Object.Equals(object o) but does not override Object.GetHashCode()

* fixes: Warning CS0108 'AvaloniaXamlIlCompiler._configuration' hides inherited member 'XamlCompiler<IXamlILEmitter, XamlILNodeEmitResult>._configuration'. Use the new keyword if hiding was intended.

* fixes: Warning CS8765 Nullability of type of parameter 'obj' doesn't match overridden member.
pull/6675/head
workgroupengineering 5 years ago
committed by GitHub
parent
commit
d0401bd01c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Avalonia.Visuals/Vector.cs
  2. 3
      src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs
  3. 6
      src/Markup/Avalonia.Markup/Markup/Parsers/PropertyPathGrammar.cs

2
src/Avalonia.Visuals/Vector.cs

@ -175,7 +175,7 @@ namespace Avalonia
MathUtilities.AreClose(_y, other._y);
}
public override bool Equals(object obj) => obj is Vector other && Equals(other);
public override bool Equals(object? obj) => obj is Vector other && Equals(other);
public override int GetHashCode()
{

3
src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlCompiler.cs

@ -14,7 +14,6 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
{
class AvaloniaXamlIlCompiler : XamlILCompiler
{
private readonly TransformerConfiguration _configuration;
private readonly IXamlType _contextType;
private readonly AvaloniaXamlIlDesignPropertiesTransformer _designTransformer;
private readonly AvaloniaBindingExtensionTransformer _bindingTransformer;
@ -22,8 +21,6 @@ namespace Avalonia.Markup.Xaml.XamlIl.CompilerExtensions
private AvaloniaXamlIlCompiler(TransformerConfiguration configuration, XamlLanguageEmitMappings<IXamlILEmitter, XamlILNodeEmitResult> emitMappings)
: base(configuration, emitMappings, true)
{
_configuration = configuration;
void InsertAfter<T>(params IXamlAstTransformer[] t)
=> Transformers.InsertRange(Transformers.FindIndex(x => x is T) + 1, t);

6
src/Markup/Avalonia.Markup/Markup/Parsers/PropertyPathGrammar.cs

@ -184,6 +184,9 @@ namespace Avalonia.Markup.Parsers
}
// Don't need to override GetHashCode as the ISyntax objects will not be stored in a hash; the
// only reason they have overridden Equals methods is for unit testing.
#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode()
public class PropertySyntax : ISyntax
{
public string Name { get; set; } = string.Empty;
@ -205,7 +208,7 @@ namespace Avalonia.Markup.Parsers
&& other.TypeName == TypeName
&& other.TypeNamespace == TypeNamespace;
}
public class ChildTraversalSyntax : ISyntax
{
public static ChildTraversalSyntax Instance { get; } = new ChildTraversalSyntax();
@ -231,5 +234,6 @@ namespace Avalonia.Markup.Parsers
&& other.TypeName == TypeName
&& other.TypeNamespace == TypeNamespace;
}
#pragma warning restore CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode()
}
}

Loading…
Cancel
Save