-
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 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
Championed proposal: dotnet/csharplang#4284
Speclet: https://github.com/dotnet/csharplang/blob/main/proposals/using-alias-types.md
Test Plan: #56323
Proposed API
using_directive
- : 'global'? 'using' ('static' | name_equals)? name ';'
+ : 'global'? 'using' ('static' | ('unsafe'? name_equals))? type ';'
;public sealed class UsingDirectiveSyntax
{
+ public SyntaxToken UnsafeToken { get; }
+ public TypeSyntax Type { get; }
- public NameSyntax Name { get; }
+ /// <summary>Returns <see cref="Type"/> if it is a <see cref="NameSyntax"/>, null otherwise.</summary>
+ public NameSyntax? Name { get; }
+ // All the Update/With methods
}
public sealed class SyntaxFactory
{
+ public static UsingDirectiveSyntax UsingDirective(NameEqualsSyntax? alias, TypeSyntax type);
+ public static UsingDirectiveSyntax UsingDirective(
+ SyntaxToken globalKeyword, SyntaxToken usingKeyword, SyntaxToken staticKeyword, SyntaxToken unsafeKeyword,
+ NameEqualsSyntax? alias, TypeSyntax type, SyntaxToken semicolonToken);
}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 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