diff --git a/codegen/inferred_relationships.hack b/codegen/inferred_relationships.hack index 6794a14ff..ba111e937 100644 --- a/codegen/inferred_relationships.hack +++ b/codegen/inferred_relationships.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<<6a9f560a7ed419acd48e8fc2a02b7b3f>> */ namespace Facebook\HHAST\__Private; @@ -517,6 +517,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ ], 'closure_type_specifier.closure_readonly_keyword' => keyset[ 'missing', + 'token:readonly', ], 'closure_type_specifier.closure_readonly_return' => keyset[ 'missing', @@ -559,6 +560,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list>', 'list>', 'list>', + 'list>', 'missing', ], 'collection_literal_expression.collection_literal_left_brace' => keyset[ @@ -756,6 +758,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list', 'list', 'list', + 'list', 'list', 'list', 'list', @@ -2823,6 +2826,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list', 'list', 'list', + 'list', 'list', 'list', ], @@ -3343,6 +3347,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list|list_item>', 'list|list_item>', 'list|list_item>', + 'list|list_item>', 'list|list_item>', 'list|list_item>', 'list|list_item>', @@ -3350,7 +3355,6 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list>', 'list>', 'list|list_item>', - 'list>', 'list>', 'list|list_item>', 'list>', @@ -3405,6 +3409,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list>', 'list|list_item>', 'list>', + 'list|list_item>', 'list>', 'list|list_item>', 'list>', diff --git a/codegen/schema.json b/codegen/schema.json index c7d3c9696..639f3fc2d 100644 --- a/codegen/schema.json +++ b/codegen/schema.json @@ -1,6 +1,6 @@ { "description" : "@generated JSON schema of the Hack Full Fidelity Parser AST", - "version" : "2021-08-09-0002", + "version" : "2021-08-12-0001", "trivia" : [ { "trivia_kind_name" : "WhiteSpace", "trivia_type_name" : "whitespace" }, @@ -155,6 +155,8 @@ "token_text" : "namespace" }, { "token_kind" : "New", "token_text" : "new" }, + { "token_kind" : "Newctx", + "token_text" : "newctx" }, { "token_kind" : "Newtype", "token_text" : "newtype" }, { "token_kind" : "Noreturn", diff --git a/codegen/syntax/ClosureTypeSpecifier.hack b/codegen/syntax/ClosureTypeSpecifier.hack index 75bee7587..beb6e8eb6 100644 --- a/codegen/syntax/ClosureTypeSpecifier.hack +++ b/codegen/syntax/ClosureTypeSpecifier.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<<470bc3c524dfcda22bd1de451b6c0b49>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -13,7 +13,7 @@ final class ClosureTypeSpecifier extends Node implements ITypeSpecifier { const string SYNTAX_KIND = 'closure_type_specifier'; private LeftParenToken $_outer_left_paren; - private ?Node $_readonly_keyword; + private ?ReadonlyToken $_readonly_keyword; private FunctionToken $_function_keyword; private LeftParenToken $_inner_left_paren; private ?NodeList> $_parameter_list; @@ -26,7 +26,7 @@ final class ClosureTypeSpecifier extends Node implements ITypeSpecifier { public function __construct( LeftParenToken $outer_left_paren, - ?Node $readonly_keyword, + ?ReadonlyToken $readonly_keyword, FunctionToken $function_keyword, LeftParenToken $inner_left_paren, ?NodeList> $parameter_list, @@ -76,7 +76,7 @@ final class ClosureTypeSpecifier extends Node implements ITypeSpecifier { $file, $offset, $source, - 'Node', + 'ReadonlyToken', ); $offset += $readonly_keyword?->getWidth() ?? 0; $function_keyword = Node::fromJSON( @@ -241,7 +241,7 @@ final class ClosureTypeSpecifier extends Node implements ITypeSpecifier { } return new static( $outer_left_paren as LeftParenToken, - $readonly_keyword as ?Node, + $readonly_keyword as ?ReadonlyToken, $function_keyword as FunctionToken, $inner_left_paren as LeftParenToken, /* HH_FIXME[4110] ?NodeList> may not be enforceable */ $parameter_list, @@ -302,7 +302,7 @@ final class ClosureTypeSpecifier extends Node implements ITypeSpecifier { return $this->_readonly_keyword; } - public function withReadonlyKeyword(?Node $value): this { + public function withReadonlyKeyword(?ReadonlyToken $value): this { if ($value === $this->_readonly_keyword) { return $this; } @@ -326,16 +326,16 @@ final class ClosureTypeSpecifier extends Node implements ITypeSpecifier { } /** - * @return null + * @return null | ReadonlyToken */ - public function getReadonlyKeyword(): ?Node { + public function getReadonlyKeyword(): ?ReadonlyToken { return $this->_readonly_keyword; } /** - * @return + * @return ReadonlyToken */ - public function getReadonlyKeywordx(): Node { + public function getReadonlyKeywordx(): ReadonlyToken { return TypeAssert\not_null($this->getReadonlyKeyword()); } diff --git a/codegen/syntax/CollectionLiteralExpression.hack b/codegen/syntax/CollectionLiteralExpression.hack index f750f3821..3ae0dc95d 100644 --- a/codegen/syntax/CollectionLiteralExpression.hack +++ b/codegen/syntax/CollectionLiteralExpression.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<4cacf94591c2655a4c83efc492c8088d>> + * @generated SignedSource<<28d1fcaf02b46d971e4278b4807901f6>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -240,7 +240,8 @@ final class CollectionLiteralExpression * NodeList> | * NodeList> | * NodeList> | - * NodeList> | null + * NodeList> | + * NodeList> | null */ public function getInitializers(): ?NodeList> { return $this->_initializers; @@ -263,7 +264,8 @@ final class CollectionLiteralExpression * NodeList> | * NodeList> | * NodeList> | - * NodeList> + * NodeList> | + * NodeList> */ public function getInitializersx(): NodeList> { return TypeAssert\not_null($this->getInitializers()); diff --git a/codegen/syntax/TupleExpression.hack b/codegen/syntax/TupleExpression.hack index bf21787f6..37f755b98 100644 --- a/codegen/syntax/TupleExpression.hack +++ b/codegen/syntax/TupleExpression.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<7c98dbc73d6cf8df02d538e1b132ce7c>> + * @generated SignedSource<<1731d01b3927d3645aaa57bbb3b0cfe4>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -225,7 +225,6 @@ final class TupleExpression extends Node implements ILambdaBody, IExpression { * NodeList> | * NodeList> | * NodeList> | - * NodeList> | * NodeList> | * NodeList> | * NodeList> | @@ -244,7 +243,6 @@ final class TupleExpression extends Node implements ILambdaBody, IExpression { * NodeList> | * NodeList> | * NodeList> | - * NodeList> | * NodeList> | * NodeList> | * NodeList> | diff --git a/codegen/token_from_data.hack b/codegen/token_from_data.hack index bb6c4623c..8a58d0071 100644 --- a/codegen/token_from_data.hack +++ b/codegen/token_from_data.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<<5f32f29bfe6a8615390d5cd7198c8e3b>> */ namespace Facebook\HHAST\__Private; use namespace Facebook\HHAST; @@ -99,6 +99,7 @@ class TokenClassMap { 'mixed' => HHAST\MixedToken::class, 'namespace' => HHAST\NamespaceToken::class, 'new' => HHAST\NewToken::class, + 'newctx' => HHAST\NewctxToken::class, 'newtype' => HHAST\NewtypeToken::class, 'noreturn' => HHAST\NoreturnToken::class, 'null' => HHAST\NullLiteralToken::class, diff --git a/codegen/tokens/NewctxToken.hack b/codegen/tokens/NewctxToken.hack new file mode 100644 index 000000000..41b9f920a --- /dev/null +++ b/codegen/tokens/NewctxToken.hack @@ -0,0 +1,20 @@ +/** + * This file is generated. Do not modify it manually! + * + * @generated SignedSource<<4f6c3d217f748925e2b1603c881dd0a5>> + */ +namespace Facebook\HHAST; + +final class NewctxToken extends TokenWithVariableText { + + const string KIND = 'newctx'; + + public function __construct( + ?NodeList $leading, + ?NodeList $trailing, + string $token_text = 'newctx', + ?__Private\SourceRef $source_ref = null, + ) { + parent::__construct($leading, $trailing, $token_text, $source_ref); + } +} diff --git a/codegen/version.hack b/codegen/version.hack index 28835a5bb..d1fb8a781 100644 --- a/codegen/version.hack +++ b/codegen/version.hack @@ -1,12 +1,12 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<35556016546d7e7241b434197e0aa70d>> + * @generated SignedSource<> */ namespace Facebook\HHAST; -const string SCHEMA_VERSION = '2021-08-09-0002'; +const string SCHEMA_VERSION = '2021-08-12-0001'; -const int HHVM_VERSION_ID = 412300; +const int HHVM_VERSION_ID = 412500; -const string HHVM_VERSION = '4.123.0-dev'; +const string HHVM_VERSION = '4.125.0-dev'; diff --git a/src/__Private/is_compatible_schema_version.hack b/src/__Private/is_compatible_schema_version.hack index e355b4d47..2262e3644 100644 --- a/src/__Private/is_compatible_schema_version.hack +++ b/src/__Private/is_compatible_schema_version.hack @@ -21,11 +21,16 @@ use const Facebook\HHAST\SCHEMA_VERSION; */ function is_compatible_schema_version(string $other_version): bool { invariant( - SCHEMA_VERSION === '2021-08-09-0002', + SCHEMA_VERSION === '2021-08-12-0001', '%s needs updating', __FILE__, ); - if ($other_version === SCHEMA_VERSION) { + if ($other_version === '2021-08-12-0001') { + // - Adds `newctx` token + // - Infers usage of `readonly` token + return true; + } + if ($other_version === '2021-08-09-0002') { return true; } return false;