-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-CompilersConcept-APIThis issue involves adding, removing, clarification, or modification of an API.This issue involves adding, removing, clarification, or modification of an API.Feature - RefStructInterfaces`allows ref struct` (ref struct interfaces)`allows ref struct` (ref struct interfaces)Feature Requestapi-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementeduntriagedIssues and PRs which have not yet been triaged by a leadIssues and PRs which have not yet been triaged by a lead
Description
Background and Motivation
https://github.com/dotnet/csharplang/blob/main/proposals/ref-struct-interfaces.md
Proposed API
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Specifies capabilities that may or may not be supported by the common language runtime the compilation is
/// targeting.
/// </summary>
public enum RuntimeCapability
{
+ /// <summary>
+ /// Indicates that this version of runtime supports generic type parameters allowing substitution with a ref struct.
+ /// </summary>
+ ByRefLikeGenerics = 8,
}
}
The name of the new enum item matches the name of the field from BCL - System.Runtime.CompilerServices.RuntimeFeature.ByRefLikeGenerics
(see https://github.com/dotnet/csharplang/blob/main/proposals/ref-struct-interfaces.md#representation-in-metadata).
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Represents a type parameter in a generic type or generic method.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ITypeParameterSymbol : ITypeSymbol
{
+ /// <summary>
+ /// True if the 'allows ref struct' constraint was specified for the type parameter.
+ /// </summary>
+ bool AllowsByRefLike { get; }
}
}
The new property is named after a flag in BCL System.Reflection.GenericParameterAttributes.AllowByRefLike
(see https://github.com/dotnet/csharplang/blob/main/proposals/ref-struct-interfaces.md#representation-in-metadata).
Metadata
Metadata
Assignees
Labels
Area-CompilersConcept-APIThis issue involves adding, removing, clarification, or modification of an API.This issue involves adding, removing, clarification, or modification of an API.Feature - RefStructInterfaces`allows ref struct` (ref struct interfaces)`allows ref struct` (ref struct interfaces)Feature Requestapi-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementeduntriagedIssues and PRs which have not yet been triaged by a leadIssues and PRs which have not yet been triaged by a lead