Browse Source

Fix #3545: Covariant return not detected for abstract override property

pull/3551/head
Siegfried Pammer 4 months ago
parent
commit
3442fad4a0
  1. 11
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CovariantReturns.cs
  2. 2
      ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

11
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CovariantReturns.cs

@ -1,5 +1,16 @@ @@ -1,5 +1,16 @@
namespace ICSharpCode.Decompiler.Tests.TestCases.CovariantReturns
{
public abstract class AbstractDerived : Base
{
public abstract override AbstractDerived Instance { get; }
public abstract override AbstractDerived this[int index] { get; }
public abstract override AbstractDerived Build();
protected abstract override AbstractDerived SetParent(object parent);
}
public abstract class Base
{
public abstract Base Instance { get; }

2
ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

@ -2126,7 +2126,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -2126,7 +2126,7 @@ namespace ICSharpCode.Decompiler.CSharp
{
SetNewModifier(propertyDecl);
}
if (getterHasBody && IsCovariantReturnOverride(property.Getter))
if (IsCovariantReturnOverride(property.Getter))
{
RemoveAttribute(getter, KnownAttribute.PreserveBaseOverrides);
propertyDecl.Modifiers &= ~(Modifiers.New | Modifiers.Virtual);

Loading…
Cancel
Save