C#: Use covariant return for context overrides

This commit is contained in:
Tamas Vajk
2021-03-03 14:35:07 +01:00
parent cfd8a87496
commit bd2b3e72f8
38 changed files with 168 additions and 176 deletions

View File

@@ -8,7 +8,7 @@ namespace Semmle.Extraction.CIL
/// </summary>
internal interface IGenericContext
{
Context Cx { get; }
Context Context { get; }
/// <summary>
/// The list of generic type parameters/arguments, including type parameters/arguments of

View File

@@ -10,8 +10,7 @@ namespace Semmle.Extraction.CIL
/// </summary>
internal abstract class LabelledEntity : Extraction.LabelledEntity, IExtractedEntity
{
// todo: with .NET 5 this can override the base context, and change the return type.
public Context Cx => (Context)base.Context;
public override Context Context => (Context)base.Context;
protected LabelledEntity(Context cx) : base(cx)
{

View File

@@ -9,8 +9,7 @@ namespace Semmle.Extraction.CIL
/// </summary>
internal abstract class UnlabelledEntity : Extraction.UnlabelledEntity, IExtractedEntity
{
// todo: with .NET 5 this can override the base context, and change the return type.
public Context Cx => (Context)base.Context;
public override Context Context => (Context)base.Context;
protected UnlabelledEntity(Context cx) : base(cx)
{