Skip to content

Commit

Permalink
Add VirtualStaticsInInterfaces flag to RuntimeFeature (#52733)
Browse files Browse the repository at this point in the history
* Add RuntimeFeature indicating support for static virtual methods in the runtime
* Mark it with the preview flag
  • Loading branch information
davidwrighton authored May 14, 2021
1 parent 88211b9 commit 1e48704
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.Versioning;

namespace System.Runtime.CompilerServices
{
public static partial class RuntimeFeature
Expand All @@ -25,6 +27,12 @@ public static partial class RuntimeFeature
/// </summary>
public const string CovariantReturnsOfClasses = nameof(CovariantReturnsOfClasses);

/// <summary>
/// Indicates that this version of runtime supports virtual static members of interfaces.
/// </summary>
[RequiresPreviewFeatures]
public const string VirtualStaticsInInterfaces = nameof(VirtualStaticsInInterfaces);

/// <summary>
/// Checks whether a certain feature is supported by the Runtime.
/// </summary>
Expand All @@ -36,6 +44,7 @@ public static bool IsSupported(string feature)
case CovariantReturnsOfClasses:
case UnmanagedSignatureCallingConvention:
case DefaultImplementationsOfInterfaces:
case VirtualStaticsInInterfaces:
return true;
case nameof(IsDynamicCodeSupported):
return IsDynamicCodeSupported;
Expand Down
2 changes: 2 additions & 0 deletions src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9770,6 +9770,8 @@ public static partial class RuntimeFeature
public const string DefaultImplementationsOfInterfaces = "DefaultImplementationsOfInterfaces";
public const string UnmanagedSignatureCallingConvention = "UnmanagedSignatureCallingConvention";
public const string PortablePdb = "PortablePdb";
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute]
public const string VirtualStaticsInInterfaces = "VirtualStaticsInInterfaces";
public static bool IsDynamicCodeCompiled { get { throw null; } }
public static bool IsDynamicCodeSupported { get { throw null; } }
public static bool IsSupported(string feature) { throw null; }
Expand Down

0 comments on commit 1e48704

Please sign in to comment.