In preparation for the addition of a compiler check for reserved identifier names in Thrift IDL, add the annotation to allow the use of the reserved identifier names.

Summary:
In addition to reserved words, Thrift reserves all identifiers that contain the case-insensitive substring `fbthrift`. Such identifiers require users to explicitly annotate the usage with `thrift.AllowReservedIdentifierName`, and may result in undefined behavior.

Implementation notes:
In a subsequent change, the Thrift compiler will return an error when it encounters any identifier name that violates the above restriction unless the identifier is annotated with `thrift.AllowReservedIdentifierName`.

Reviewed By: praihan

Differential Revision: D58202161

fbshipit-source-id: df6033cfe99594041a7be71f2310c80205b65261
This commit is contained in:
Satish Kumar 2024-06-26 09:05:14 -07:00 committed by Facebook GitHub Bot
parent b1caca7b05
commit da492cce6a

View File

@ -249,3 +249,24 @@ enum RpcPriority {
struct DeprecatedUnvalidatedAnnotations {
1: map<string, string> items;
}
/**
* In addition to reserved words, Thrift reserves all identifiers
* that contain the case-insensitive substring fbthrift.
* The use of such identifiers requires users to explicitly annotate
* the usage with `@thrift.AllowReservedIdentifierName`,
* and may result in undefined behavior.
*/
@scope.Const
@scope.Enum
@scope.EnumValue
@scope.Exception
@scope.Field
@scope.Function
@scope.Interaction
@scope.Program
@scope.Service
@scope.Struct
@scope.Typedef
@scope.Union
struct AllowReservedIdentifierName {}