Use covariant return types.
Use the covariant return type feature of C# 9 to allow method overrides to be more specific about their return type. By exposing this information, e.g. for Widget.Clone(), callers will have more information. This allows various casts to be removed as the information is now available within the type system.
This commit is contained in:
@@ -631,7 +631,7 @@ namespace OpenRA.Widgets
|
||||
}
|
||||
|
||||
public override string GetCursor(int2 pos) { return null; }
|
||||
public override Widget Clone() { return new ContainerWidget(this); }
|
||||
public override ContainerWidget Clone() { return new ContainerWidget(this); }
|
||||
|
||||
public override bool HandleMouseInput(MouseInput mi)
|
||||
{
|
||||
@@ -655,7 +655,7 @@ namespace OpenRA.Widgets
|
||||
IsDisabled = () => other.Disabled;
|
||||
}
|
||||
|
||||
public override Widget Clone() { return new InputWidget(this); }
|
||||
public override InputWidget Clone() { return new InputWidget(this); }
|
||||
}
|
||||
|
||||
public class WidgetArgs : Dictionary<string, object>
|
||||
|
||||
Reference in New Issue
Block a user