-
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 - First-class Span TypesFeature 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
The first-class Span types feature is adding new span conversions. For consistency with other conversions, it would be good to have the API proposed below.
Proposed API
namespace Microsoft.CodeAnalysis.CSharp;
public readonly struct Conversion
{
+ public bool IsSpan { get; }
}Usage Examples
var comp = new CSharpCompilation(...);
var tree = comp.SyntaxTrees.Single();
var model = comp.GetSemanticModel(tree);
var expr = tree.GetRoot().DescendantNodes()...;
var conversion = model.GetConversion(expr);
Assert.True(conversion.IsSpan); // used hereAlternative Designs
- Leave the API internal.
- Provide details about which span conversion it is (array to Span/ReadOnlySpan, Span to ReadOnlySpan, ReadOnlySpan to ReadOnlySpan, string to ReadOnlySpan).
- Provide details about the methods that will be used in codegen.
Risks
- We might remove the feature and then the API will be useless?
Reactions are currently unavailable
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 - First-class Span TypesFeature 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