diff --git a/codegen-no-rebuild/latest_breaking_version.hack b/codegen-no-rebuild/latest_breaking_version.hack index 45445fe04..43f388bdf 100644 --- a/codegen-no-rebuild/latest_breaking_version.hack +++ b/codegen-no-rebuild/latest_breaking_version.hack @@ -1,12 +1,12 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<<3a64509d37cde70c9abf620cc470ce3d>> */ namespace Facebook\HHAST; -const string LATEST_BREAKING_SCHEMA_VERSION = '2022-05-16-0000'; +const string LATEST_BREAKING_SCHEMA_VERSION = '2022-09-29-0000'; -const int LATEST_BREAKING_HHVM_VERSION_ID = 416100; +const int LATEST_BREAKING_HHVM_VERSION_ID = 417300; -const string LATEST_BREAKING_HHVM_VERSION = '4.161.0-dev'; +const string LATEST_BREAKING_HHVM_VERSION = '4.173.0-dev'; diff --git a/codegen/inferred_relationships.hack b/codegen/inferred_relationships.hack index 6e93cb415..d6834ea9a 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<> */ namespace Facebook\HHAST\__Private; @@ -11,8 +11,8 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'old_attribute_specification', ], 'alias_declaration.alias_constraint' => keyset[ + 'list', 'missing', - 'type_constraint', ], 'alias_declaration.alias_equal' => keyset[ 'token:=', @@ -26,7 +26,9 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'token:type', ], 'alias_declaration.alias_modifiers' => keyset[ - 'list', + 'missing', + ], + 'alias_declaration.alias_module_kw_opt' => keyset[ 'missing', ], 'alias_declaration.alias_name' => keyset[ @@ -41,9 +43,11 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'dictionary_type_specifier', 'generic_type_specifier', 'keyset_type_specifier', + 'like_type_specifier', 'nullable_type_specifier', 'shape_type_specifier', 'simple_type_specifier', + 'soft_type_specifier', 'tuple_type_specifier', 'varray_type_specifier', 'vector_type_specifier', @@ -111,6 +115,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'missing', ], 'as_expression.as_left_operand' => keyset[ + 'as_expression', 'function_call_expression', 'literal', 'member_selection_expression', @@ -141,6 +146,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'darray_type_specifier', 'dictionary_type_specifier', 'generic_type_specifier', + 'like_type_specifier', 'nullable_type_specifier', 'simple_type_specifier', 'tuple_type_specifier', @@ -305,6 +311,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'function_call_expression', 'literal', 'object_creation_expression', + 'parenthesized_expression', 'prefix_unary_expression', 'scope_resolution_expression', 'token:name', @@ -442,8 +449,6 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list', 'list', 'list', - 'list', - 'list', 'missing', ], 'classish_declaration.classish_name' => keyset[ @@ -479,6 +484,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'missing', 'simple_type_specifier', 'type_constant', + 'type_refinement', ], 'closure_parameter_type_specifier.closure_parameter_call_convention' => keyset[ @@ -491,6 +497,8 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'closure_parameter_type_specifier.closure_parameter_type' => keyset[ 'attributized_specifier', 'closure_type_specifier', + 'darray_type_specifier', + 'dictionary_type_specifier', 'generic_type_specifier', 'nullable_type_specifier', 'simple_type_specifier', @@ -539,6 +547,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'like_type_specifier', 'nullable_type_specifier', 'simple_type_specifier', + 'type_refinement', 'vector_type_specifier', ], 'collection_literal_expression.collection_literal_initializers' => keyset[ @@ -622,6 +631,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list', 'list', 'list', + 'list', 'list', 'list', 'list', @@ -907,9 +917,12 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list|list_item|list_item>', 'list|list_item>', 'list>', + 'list|list_item>', 'list|list_item>', 'list>', 'list|list_item>', + 'list>', + 'list|list_item>', 'list>', 'list|list_item>', 'list|list_item|list_item>', @@ -1157,6 +1170,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list|list_item>', 'list>', 'list|list_item>', + 'list|list_item>', 'list|list_item>', 'list|list_item>', ], @@ -1169,6 +1183,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ ], 'do_statement.do_condition' => keyset[ 'binary_expression', + 'function_call_expression', 'literal', 'subscript_expression', 'variable', @@ -1341,8 +1356,6 @@ const dict> INFERRED_RELATIONSHIPS = dict[ ], 'enum_class_declaration.enum_class_modifiers' => keyset[ 'list', - 'list', - 'list', 'missing', ], 'enum_class_declaration.enum_class_name' => keyset[ @@ -1376,8 +1389,13 @@ const dict> INFERRED_RELATIONSHIPS = dict[ ], 'enum_declaration.enum_base' => keyset[ 'classname_type_specifier', + 'closure_type_specifier', + 'dictionary_type_specifier', 'generic_type_specifier', + 'keyset_type_specifier', + 'nullable_type_specifier', 'simple_type_specifier', + 'vector_type_specifier', ], 'enum_declaration.enum_colon' => keyset[ 'token::', @@ -1393,7 +1411,6 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'token:{', ], 'enum_declaration.enum_modifiers' => keyset[ - 'list', 'missing', ], 'enum_declaration.enum_name' => keyset[ @@ -1470,12 +1487,15 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'object_creation_expression', 'postfix_unary_expression', 'prefix_unary_expression', + 'prefixed_code', 'safe_member_selection_expression', 'scope_resolution_expression', + 'shape_expression', 'subscript_expression', 'token:name', 'variable', 'varray_intrinsic_expression', + 'vector_intrinsic_expression', 'xhp_expression', 'yield_expression', ], @@ -2048,7 +2068,9 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'token:(', ], 'function_call_expression.function_call_receiver' => keyset[ + 'anonymous_function', 'function_call_expression', + 'lambda_expression', 'member_selection_expression', 'parenthesized_expression', 'qualified_name', @@ -2117,8 +2139,6 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list', 'list', 'list', - 'list', - 'list', 'list', 'list', 'list', @@ -2162,6 +2182,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'token:noreturn', 'tuple_type_specifier', 'type_constant', + 'type_refinement', 'varray_type_specifier', 'vector_type_specifier', ], @@ -2248,6 +2269,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ ], 'is_expression.is_left_operand' => keyset[ 'anonymous_function', + 'as_expression', 'function_call_expression', 'literal', 'member_selection_expression', @@ -2418,6 +2440,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'generic_type_specifier', 'like_type_specifier', 'simple_type_specifier', + 'soft_type_specifier', 'type_constant', 'varray_type_specifier', 'vector_type_specifier', @@ -2507,7 +2530,9 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'tuple_expression', 'tuple_type_specifier', 'type_constant', + 'type_in_refinement', 'type_parameter', + 'type_refinement', 'variable', 'variadic_parameter', 'varray_intrinsic_expression', @@ -2573,9 +2598,14 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'token:;', ], 'module_declaration.module_declaration_attribute_spec' => keyset[ - 'missing', 'old_attribute_specification', ], + 'module_declaration.module_declaration_exports' => keyset[ + 'missing', + ], + 'module_declaration.module_declaration_imports' => keyset[ + 'missing', + ], 'module_declaration.module_declaration_left_brace' => keyset[ 'token:{', ], @@ -2583,7 +2613,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'token:module', ], 'module_declaration.module_declaration_name' => keyset[ - 'token:name', + 'module_name', ], 'module_declaration.module_declaration_new_keyword' => keyset[ 'token:new', @@ -2596,12 +2626,15 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'token:module', ], 'module_membership_declaration.module_membership_declaration_name' => keyset[ - 'token:name', + 'module_name', ], 'module_membership_declaration.module_membership_declaration_semicolon' => keyset[ 'token:;', ], + 'module_name.module_name_parts' => keyset[ + 'list>', + ], 'namespace_body.namespace_declarations' => keyset[ 'list', 'list', @@ -2729,9 +2762,11 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'darray_type_specifier', 'dictionary_type_specifier', 'generic_type_specifier', + 'keyset_type_specifier', 'like_type_specifier', 'shape_type_specifier', 'simple_type_specifier', + 'soft_type_specifier', 'tuple_type_specifier', 'type_constant', 'varray_type_specifier', @@ -2789,6 +2824,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'simple_type_specifier', 'tuple_type_specifier', 'type_constant', + 'type_refinement', 'varray_type_specifier', 'vector_type_specifier', ], @@ -2895,8 +2931,6 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list>', ], 'property_declaration.property_modifiers' => keyset[ - 'list', - 'list', 'list', 'list', 'list', @@ -2942,6 +2976,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'token:require', ], 'require_clause.require_kind' => keyset[ + 'token:class', 'token:extends', 'token:implements', ], @@ -3032,8 +3067,9 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list', 'list', 'list', - 'list', 'list', + 'list', + 'list', 'list', 'list', 'list', @@ -3050,10 +3086,10 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list', 'list', 'list', + 'list', 'list', 'list', 'list', - 'list', 'list', 'list', 'list', @@ -3073,7 +3109,6 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list', 'list', 'list', - 'list', 'list', 'list', 'list', @@ -3081,8 +3116,6 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list', 'list', 'list', - 'list', - 'list', 'list', 'list', 'list', @@ -3180,6 +3213,13 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'token:void', 'token:xhp', ], + 'soft_type_specifier.soft_at' => keyset[ + 'token:@', + ], + 'soft_type_specifier.soft_type' => keyset[ + 'like_type_specifier', + 'simple_type_specifier', + ], 'subscript_expression.subscript_index' => keyset[ 'binary_expression', 'cast_expression', @@ -3429,6 +3469,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list|list_item>', 'list>', 'list|list_item>', + 'list|list_item>', 'list>', 'list|list_item>', 'list|list_item>', @@ -3441,9 +3482,11 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list>', 'list|list_item>', 'list|list_item>', + 'list|list_item>', 'list|list_item>', 'list>', 'list>', + 'list>', 'list>', 'list>', 'missing', @@ -3523,9 +3566,29 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'shape_type_specifier', 'simple_type_specifier', 'type_constant', + 'type_refinement', 'varray_type_specifier', 'vector_type_specifier', ], + 'type_in_refinement.type_in_refinement_constraints' => keyset[ + 'missing', + ], + 'type_in_refinement.type_in_refinement_equal' => keyset[ + 'token:=', + ], + 'type_in_refinement.type_in_refinement_keyword' => keyset[ + 'token:type', + ], + 'type_in_refinement.type_in_refinement_name' => keyset[ + 'token:name', + ], + 'type_in_refinement.type_in_refinement_type' => keyset[ + 'simple_type_specifier', + 'type_constant', + ], + 'type_in_refinement.type_in_refinement_type_parameters' => keyset[ + 'missing', + ], 'type_parameter.type_attribute_spec' => keyset[ 'missing', 'old_attribute_specification', @@ -3559,6 +3622,21 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'type_parameters.type_parameters_right_angle' => keyset[ 'token:>', ], + 'type_refinement.type_refinement_keyword' => keyset[ + 'token:with', + ], + 'type_refinement.type_refinement_left_brace' => keyset[ + 'token:{', + ], + 'type_refinement.type_refinement_members' => keyset[ + 'list>', + ], + 'type_refinement.type_refinement_right_brace' => keyset[ + 'token:}', + ], + 'type_refinement.type_refinement_type' => keyset[ + 'simple_type_specifier', + ], 'unset_statement.unset_keyword' => keyset[ 'token:unset', ], @@ -3803,6 +3881,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list|list_item>', 'list>', 'list|list_item|list_item|list_item|list_item>', + 'list|list_item|list_item|list_item>', 'list|list_item|list_item|list_item>', 'list>', 'list>', @@ -3818,6 +3897,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'list|list_item|list_item>', 'list>', 'list|list_item|list_item|list_item|list_item>', + 'list|list_item|list_item|list_item|list_item|list_item>', 'list|list_item>', 'list|list_item|list_item>', 'list|list_item|list_item>', @@ -3915,6 +3995,7 @@ const dict> INFERRED_RELATIONSHIPS = dict[ 'nullable_type_specifier', 'simple_type_specifier', 'type_constant', + 'type_refinement', 'vector_type_specifier', ], 'while_statement.while_body' => keyset[ diff --git a/codegen/node_from_json.hack b/codegen/node_from_json.hack index 017604a74..f808102db 100644 --- a/codegen/node_from_json.hack +++ b/codegen/node_from_json.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<> */ namespace Facebook\HHAST\__Private; use namespace Facebook\HHAST; @@ -128,7 +128,10 @@ function node_from_json_unwrapped( 'methodish_declaration' => HHAST\MethodishDeclaration::class, 'methodish_trait_resolution' => HHAST\MethodishTraitResolution::class, 'module_declaration' => HHAST\ModuleDeclaration::class, + 'module_exports' => HHAST\ModuleExports::class, + 'module_imports' => HHAST\ModuleImports::class, 'module_membership_declaration' => HHAST\ModuleMembershipDeclaration::class, + 'module_name' => HHAST\ModuleName::class, 'namespace_body' => HHAST\NamespaceBody::class, 'namespace_declaration' => HHAST\NamespaceDeclaration::class, 'namespace_declaration_header' => HHAST\NamespaceDeclarationHeader::class, @@ -141,6 +144,9 @@ function node_from_json_unwrapped( 'nullable_type_specifier' => HHAST\NullableTypeSpecifier::class, 'object_creation_expression' => HHAST\ObjectCreationExpression::class, 'old_attribute_specification' => HHAST\OldAttributeSpecification::class, + 'package_declaration' => HHAST\PackageDeclaration::class, + 'package_includes' => HHAST\PackageIncludes::class, + 'package_uses' => HHAST\PackageUses::class, 'parameter_declaration' => HHAST\ParameterDeclaration::class, 'parenthesized_expression' => HHAST\ParenthesizedExpression::class, 'pipe_variable' => HHAST\PipeVariableExpression::class, diff --git a/codegen/schema.json b/codegen/schema.json index 16073e288..a67b19f3a 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" : "2022-05-16-0000", + "version" : "2022-09-29-0000", "trivia" : [ { "trivia_kind_name" : "WhiteSpace", "trivia_type_name" : "whitespace" }, @@ -55,6 +55,8 @@ "token_text" : "classname" }, { "token_kind" : "Clone", "token_text" : "clone" }, + { "token_kind" : "Concurrent", + "token_text" : "concurrent" }, { "token_kind" : "Const", "token_text" : "const" }, { "token_kind" : "Construct", @@ -67,8 +69,6 @@ "token_text" : "darray" }, { "token_kind" : "Default", "token_text" : "default" }, - { "token_kind" : "Define", - "token_text" : "define" }, { "token_kind" : "Dict", "token_text" : "dict" }, { "token_kind" : "Do", @@ -81,20 +81,14 @@ "token_text" : "else" }, { "token_kind" : "Empty", "token_text" : "empty" }, - { "token_kind" : "Endfor", - "token_text" : "endfor" }, - { "token_kind" : "Endforeach", - "token_text" : "endforeach" }, { "token_kind" : "Endif", "token_text" : "endif" }, - { "token_kind" : "Endswitch", - "token_text" : "endswitch" }, - { "token_kind" : "Endwhile", - "token_text" : "endwhile" }, { "token_kind" : "Enum", "token_text" : "enum" }, { "token_kind" : "Eval", "token_text" : "eval" }, + { "token_kind" : "Exports", + "token_text" : "exports" }, { "token_kind" : "Extends", "token_text" : "extends" }, { "token_kind" : "Fallthrough", @@ -111,18 +105,16 @@ "token_text" : "for" }, { "token_kind" : "Foreach", "token_text" : "foreach" }, - { "token_kind" : "From", - "token_text" : "from" }, { "token_kind" : "Function", "token_text" : "function" }, { "token_kind" : "Global", "token_text" : "global" }, - { "token_kind" : "Concurrent", - "token_text" : "concurrent" }, { "token_kind" : "If", "token_text" : "if" }, { "token_kind" : "Implements", "token_text" : "implements" }, + { "token_kind" : "Imports", + "token_text" : "imports" }, { "token_kind" : "Include", "token_text" : "include" }, { "token_kind" : "Include_once", @@ -145,6 +137,8 @@ "token_text" : "isset" }, { "token_kind" : "Keyset", "token_text" : "keyset" }, + { "token_kind" : "Lateinit", + "token_text" : "lateinit" }, { "token_kind" : "List", "token_text" : "list" }, { "token_kind" : "Mixed", @@ -183,8 +177,6 @@ "token_text" : "require_once" }, { "token_kind" : "Required", "token_text" : "required" }, - { "token_kind" : "Lateinit", - "token_text" : "lateinit" }, { "token_kind" : "Resource", "token_text" : "resource" }, { "token_kind" : "Return", @@ -383,6 +375,8 @@ "token_text" : "readonly" }, { "token_kind" : "Internal", "token_text" : "internal" }, + { "token_kind" : "Package", + "token_text" : "package" }, { "token_kind" : "ErrorToken", "token_text" : null }, @@ -459,6 +453,13 @@ "fields" : [ { "field_name" : "parts" } ] }, + { "kind_name" : "ModuleName", + "type_name" : "module_name", + "description" : "module_name", + "prefix" : "module_name", + "fields" : [ + { "field_name" : "parts" } + ] }, { "kind_name" : "SimpleTypeSpecifier", "type_name" : "simple_type_specifier", "description" : "simple_type_specifier", @@ -588,6 +589,7 @@ "fields" : [ { "field_name" : "attribute_spec" }, { "field_name" : "modifiers" }, + { "field_name" : "module_kw_opt" }, { "field_name" : "keyword" }, { "field_name" : "name" }, { "field_name" : "generic_parameter" }, @@ -2108,6 +2110,28 @@ { "field_name" : "module_keyword" }, { "field_name" : "name" }, { "field_name" : "left_brace" }, + { "field_name" : "exports" }, + { "field_name" : "imports" }, + { "field_name" : "right_brace" } + ] }, + { "kind_name" : "ModuleExports", + "type_name" : "module_exports", + "description" : "module_exports", + "prefix" : "module_exports", + "fields" : [ + { "field_name" : "exports_keyword" }, + { "field_name" : "left_brace" }, + { "field_name" : "exports" }, + { "field_name" : "right_brace" } + ] }, + { "kind_name" : "ModuleImports", + "type_name" : "module_imports", + "description" : "module_imports", + "prefix" : "module_imports", + "fields" : [ + { "field_name" : "imports_keyword" }, + { "field_name" : "left_brace" }, + { "field_name" : "imports" }, { "field_name" : "right_brace" } ] }, { "kind_name" : "ModuleMembershipDeclaration", @@ -2119,6 +2143,39 @@ { "field_name" : "name" }, { "field_name" : "semicolon" } ] }, + { "kind_name" : "PackageDeclaration", + "type_name" : "package_declaration", + "description" : "package_declaration", + "prefix" : "package_declaration", + "fields" : [ + { "field_name" : "attribute_spec" }, + { "field_name" : "package_keyword" }, + { "field_name" : "name" }, + { "field_name" : "left_brace" }, + { "field_name" : "uses" }, + { "field_name" : "includes" }, + { "field_name" : "right_brace" } + ] }, + { "kind_name" : "PackageUses", + "type_name" : "package_uses", + "description" : "package_uses", + "prefix" : "package_uses", + "fields" : [ + { "field_name" : "use_keyword" }, + { "field_name" : "left_brace" }, + { "field_name" : "uses" }, + { "field_name" : "right_brace" } + ] }, + { "kind_name" : "PackageIncludes", + "type_name" : "package_includes", + "description" : "package_includes", + "prefix" : "package_includes", + "fields" : [ + { "field_name" : "include_keyword" }, + { "field_name" : "left_brace" }, + { "field_name" : "includes" }, + { "field_name" : "right_brace" } + ] }, { "kind_name" : "Token", "type_name" : "token", diff --git a/codegen/syntax/AliasDeclaration.hack b/codegen/syntax/AliasDeclaration.hack index fbe4011cc..41fd17ffa 100644 --- a/codegen/syntax/AliasDeclaration.hack +++ b/codegen/syntax/AliasDeclaration.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<2f4f00c2152c863caf9083133d1f626f>> + * @generated SignedSource<<27b32b5ffabaaeeac88bf08eea4ad05d>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -15,22 +15,24 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { const string SYNTAX_KIND = 'alias_declaration'; private ?OldAttributeSpecification $_attribute_spec; - private ?NodeList $_modifiers; + private ?Node $_modifiers; + private ?Node $_module_kw_opt; private Token $_keyword; private NameToken $_name; private ?TypeParameters $_generic_parameter; - private ?TypeConstraint $_constraint; + private ?NodeList $_constraint; private EqualToken $_equal; private ITypeSpecifier $_type; private SemicolonToken $_semicolon; public function __construct( ?OldAttributeSpecification $attribute_spec, - ?NodeList $modifiers, + ?Node $modifiers, + ?Node $module_kw_opt, Token $keyword, NameToken $name, ?TypeParameters $generic_parameter, - ?TypeConstraint $constraint, + ?NodeList $constraint, EqualToken $equal, ITypeSpecifier $type, SemicolonToken $semicolon, @@ -38,6 +40,7 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { ) { $this->_attribute_spec = $attribute_spec; $this->_modifiers = $modifiers; + $this->_module_kw_opt = $module_kw_opt; $this->_keyword = $keyword; $this->_name = $name; $this->_generic_parameter = $generic_parameter; @@ -71,9 +74,17 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { $file, $offset, $source, - 'NodeList', + 'Node', ); $offset += $modifiers?->getWidth() ?? 0; + $module_kw_opt = Node::fromJSON( + ($json['alias_module_kw_opt'] ?? dict['kind' => 'missing']) as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $module_kw_opt?->getWidth() ?? 0; $keyword = Node::fromJSON( ($json['alias_keyword']) as dict<_, _>, $file, @@ -106,7 +117,7 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { $file, $offset, $source, - 'TypeConstraint', + 'NodeList', ); $offset += $constraint?->getWidth() ?? 0; $equal = Node::fromJSON( @@ -145,6 +156,7 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { return new static( /* HH_IGNORE_ERROR[4110] */ $attribute_spec, /* HH_IGNORE_ERROR[4110] */ $modifiers, + /* HH_IGNORE_ERROR[4110] */ $module_kw_opt, /* HH_IGNORE_ERROR[4110] */ $keyword, /* HH_IGNORE_ERROR[4110] */ $name, /* HH_IGNORE_ERROR[4110] */ $generic_parameter, @@ -161,6 +173,7 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { return dict[ 'attribute_spec' => $this->_attribute_spec, 'modifiers' => $this->_modifiers, + 'module_kw_opt' => $this->_module_kw_opt, 'keyword' => $this->_keyword, 'name' => $this->_name, 'generic_parameter' => $this->_generic_parameter, @@ -184,6 +197,9 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { $modifiers = $this->_modifiers === null ? null : $rewriter($this->_modifiers, $parents); + $module_kw_opt = $this->_module_kw_opt === null + ? null + : $rewriter($this->_module_kw_opt, $parents); $keyword = $rewriter($this->_keyword, $parents); $name = $rewriter($this->_name, $parents); $generic_parameter = $this->_generic_parameter === null @@ -198,6 +214,7 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { if ( $attribute_spec === $this->_attribute_spec && $modifiers === $this->_modifiers && + $module_kw_opt === $this->_module_kw_opt && $keyword === $this->_keyword && $name === $this->_name && $generic_parameter === $this->_generic_parameter && @@ -210,11 +227,12 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { } return new static( $attribute_spec as ?OldAttributeSpecification, - /* HH_FIXME[4110] ?NodeList may not be enforceable */ $modifiers, + $modifiers as ?Node, + $module_kw_opt as ?Node, $keyword as Token, $name as NameToken, $generic_parameter as ?TypeParameters, - $constraint as ?TypeConstraint, + /* HH_FIXME[4110] ?NodeList may not be enforceable */ $constraint, $equal as EqualToken, $type as ITypeSpecifier, $semicolon as SemicolonToken, @@ -232,6 +250,7 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { return new static( $value, $this->_modifiers, + $this->_module_kw_opt, $this->_keyword, $this->_name, $this->_generic_parameter, @@ -264,13 +283,14 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { return $this->_modifiers; } - public function withModifiers(?NodeList $value): this { + public function withModifiers(?Node $value): this { if ($value === $this->_modifiers) { return $this; } return new static( $this->_attribute_spec, $value, + $this->_module_kw_opt, $this->_keyword, $this->_name, $this->_generic_parameter, @@ -286,19 +306,59 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { } /** - * @return NodeList | null + * @return null */ - public function getModifiers(): ?NodeList { + public function getModifiers(): ?Node { return $this->_modifiers; } /** - * @return NodeList + * @return */ - public function getModifiersx(): NodeList { + public function getModifiersx(): Node { return TypeAssert\not_null($this->getModifiers()); } + public function getModuleKwOptUNTYPED(): ?Node { + return $this->_module_kw_opt; + } + + public function withModuleKwOpt(?Node $value): this { + if ($value === $this->_module_kw_opt) { + return $this; + } + return new static( + $this->_attribute_spec, + $this->_modifiers, + $value, + $this->_keyword, + $this->_name, + $this->_generic_parameter, + $this->_constraint, + $this->_equal, + $this->_type, + $this->_semicolon, + ); + } + + public function hasModuleKwOpt(): bool { + return $this->_module_kw_opt !== null; + } + + /** + * @return null + */ + public function getModuleKwOpt(): ?Node { + return $this->_module_kw_opt; + } + + /** + * @return + */ + public function getModuleKwOptx(): Node { + return TypeAssert\not_null($this->getModuleKwOpt()); + } + public function getKeywordUNTYPED(): ?Node { return $this->_keyword; } @@ -310,6 +370,7 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { return new static( $this->_attribute_spec, $this->_modifiers, + $this->_module_kw_opt, $value, $this->_name, $this->_generic_parameter, @@ -349,6 +410,7 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { return new static( $this->_attribute_spec, $this->_modifiers, + $this->_module_kw_opt, $this->_keyword, $value, $this->_generic_parameter, @@ -388,6 +450,7 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { return new static( $this->_attribute_spec, $this->_modifiers, + $this->_module_kw_opt, $this->_keyword, $this->_name, $value, @@ -420,13 +483,14 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { return $this->_constraint; } - public function withConstraint(?TypeConstraint $value): this { + public function withConstraint(?NodeList $value): this { if ($value === $this->_constraint) { return $this; } return new static( $this->_attribute_spec, $this->_modifiers, + $this->_module_kw_opt, $this->_keyword, $this->_name, $this->_generic_parameter, @@ -442,16 +506,16 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { } /** - * @return null | TypeConstraint + * @return NodeList | null */ - public function getConstraint(): ?TypeConstraint { + public function getConstraint(): ?NodeList { return $this->_constraint; } /** - * @return TypeConstraint + * @return NodeList */ - public function getConstraintx(): TypeConstraint { + public function getConstraintx(): NodeList { return TypeAssert\not_null($this->getConstraint()); } @@ -466,6 +530,7 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { return new static( $this->_attribute_spec, $this->_modifiers, + $this->_module_kw_opt, $this->_keyword, $this->_name, $this->_generic_parameter, @@ -505,6 +570,7 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { return new static( $this->_attribute_spec, $this->_modifiers, + $this->_module_kw_opt, $this->_keyword, $this->_name, $this->_generic_parameter, @@ -522,8 +588,9 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { /** * @return ClosureTypeSpecifier | DarrayTypeSpecifier | * DictionaryTypeSpecifier | GenericTypeSpecifier | KeysetTypeSpecifier | - * NullableTypeSpecifier | ShapeTypeSpecifier | SimpleTypeSpecifier | - * TupleTypeSpecifier | VarrayTypeSpecifier | VectorTypeSpecifier + * LikeTypeSpecifier | NullableTypeSpecifier | ShapeTypeSpecifier | + * SimpleTypeSpecifier | SoftTypeSpecifier | TupleTypeSpecifier | + * VarrayTypeSpecifier | VectorTypeSpecifier */ public function getType(): ITypeSpecifier { return TypeAssert\instance_of(ITypeSpecifier::class, $this->_type); @@ -532,8 +599,9 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { /** * @return ClosureTypeSpecifier | DarrayTypeSpecifier | * DictionaryTypeSpecifier | GenericTypeSpecifier | KeysetTypeSpecifier | - * NullableTypeSpecifier | ShapeTypeSpecifier | SimpleTypeSpecifier | - * TupleTypeSpecifier | VarrayTypeSpecifier | VectorTypeSpecifier + * LikeTypeSpecifier | NullableTypeSpecifier | ShapeTypeSpecifier | + * SimpleTypeSpecifier | SoftTypeSpecifier | TupleTypeSpecifier | + * VarrayTypeSpecifier | VectorTypeSpecifier */ public function getTypex(): ITypeSpecifier { return $this->getType(); @@ -550,6 +618,7 @@ final class AliasDeclaration extends Node implements IHasAttributeSpec { return new static( $this->_attribute_spec, $this->_modifiers, + $this->_module_kw_opt, $this->_keyword, $this->_name, $this->_generic_parameter, diff --git a/codegen/syntax/AsExpression.hack b/codegen/syntax/AsExpression.hack index 66c0ac366..b3c7210b5 100644 --- a/codegen/syntax/AsExpression.hack +++ b/codegen/syntax/AsExpression.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<4aa3681cf5924d40e1e6cd951626c039>> + * @generated SignedSource<<543d941329cda45a434d2534a4c3d432>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -129,7 +129,7 @@ final class AsExpression extends Node implements ILambdaBody, IExpression { } /** - * @return FunctionCallExpression | LiteralExpression | + * @return AsExpression | FunctionCallExpression | LiteralExpression | * MemberSelectionExpression | ParenthesizedExpression | * PrefixUnaryExpression | ShapeExpression | SubscriptExpression | * TupleExpression | VariableExpression @@ -139,7 +139,7 @@ final class AsExpression extends Node implements ILambdaBody, IExpression { } /** - * @return FunctionCallExpression | LiteralExpression | + * @return AsExpression | FunctionCallExpression | LiteralExpression | * MemberSelectionExpression | ParenthesizedExpression | * PrefixUnaryExpression | ShapeExpression | SubscriptExpression | * TupleExpression | VariableExpression diff --git a/codegen/syntax/AttributizedSpecifier.hack b/codegen/syntax/AttributizedSpecifier.hack index b17982bd0..87a77433d 100644 --- a/codegen/syntax/AttributizedSpecifier.hack +++ b/codegen/syntax/AttributizedSpecifier.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<0292b8b73ed163d95845503bd88c184a>> + * @generated SignedSource<<029c9c45acb4f6a4de09537c73291050>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -142,8 +142,8 @@ final class AttributizedSpecifier extends Node implements ITypeSpecifier { /** * @return ClosureTypeSpecifier | DarrayTypeSpecifier | - * DictionaryTypeSpecifier | GenericTypeSpecifier | NullableTypeSpecifier | - * SimpleTypeSpecifier | TupleTypeSpecifier + * DictionaryTypeSpecifier | GenericTypeSpecifier | LikeTypeSpecifier | + * NullableTypeSpecifier | SimpleTypeSpecifier | TupleTypeSpecifier */ public function getType(): ITypeSpecifier { return TypeAssert\instance_of(ITypeSpecifier::class, $this->_type); @@ -151,8 +151,8 @@ final class AttributizedSpecifier extends Node implements ITypeSpecifier { /** * @return ClosureTypeSpecifier | DarrayTypeSpecifier | - * DictionaryTypeSpecifier | GenericTypeSpecifier | NullableTypeSpecifier | - * SimpleTypeSpecifier | TupleTypeSpecifier + * DictionaryTypeSpecifier | GenericTypeSpecifier | LikeTypeSpecifier | + * NullableTypeSpecifier | SimpleTypeSpecifier | TupleTypeSpecifier */ public function getTypex(): ITypeSpecifier { return $this->getType(); diff --git a/codegen/syntax/CaseLabel.hack b/codegen/syntax/CaseLabel.hack index 57dc5f44c..2f1787cbd 100644 --- a/codegen/syntax/CaseLabel.hack +++ b/codegen/syntax/CaseLabel.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<<4b31993b99a2ba9810f46d0ef63e67b7>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -160,8 +160,8 @@ final class CaseLabel extends Node implements ISwitchLabel { /** * @return CastExpression | CollectionLiteralExpression | * EnumClassLabelExpression | FunctionCallExpression | LiteralExpression | - * ObjectCreationExpression | PrefixUnaryExpression | - * ScopeResolutionExpression | NameToken | VariableExpression | + * ObjectCreationExpression | ParenthesizedExpression | PrefixUnaryExpression + * | ScopeResolutionExpression | NameToken | VariableExpression | * VectorIntrinsicExpression */ public function getExpression(): IExpression { @@ -171,8 +171,8 @@ final class CaseLabel extends Node implements ISwitchLabel { /** * @return CastExpression | CollectionLiteralExpression | * EnumClassLabelExpression | FunctionCallExpression | LiteralExpression | - * ObjectCreationExpression | PrefixUnaryExpression | - * ScopeResolutionExpression | NameToken | VariableExpression | + * ObjectCreationExpression | ParenthesizedExpression | PrefixUnaryExpression + * | ScopeResolutionExpression | NameToken | VariableExpression | * VectorIntrinsicExpression */ public function getExpressionx(): IExpression { diff --git a/codegen/syntax/ClassishDeclaration.hack b/codegen/syntax/ClassishDeclaration.hack index 5db579f43..c62c608db 100644 --- a/codegen/syntax/ClassishDeclaration.hack +++ b/codegen/syntax/ClassishDeclaration.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<<0b4b3a0c25254e05f99adb00d9e667f8>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -359,15 +359,14 @@ final class ClassishDeclaration /** * @return NodeList | NodeList | NodeList | - * NodeList | NodeList | null + * null */ public function getModifiers(): ?NodeList { return $this->_modifiers; } /** - * @return NodeList | NodeList | NodeList | - * NodeList | NodeList + * @return NodeList | NodeList | NodeList */ public function getModifiersx(): NodeList { return TypeAssert\not_null($this->getModifiers()); diff --git a/codegen/syntax/ClassnameTypeSpecifier.hack b/codegen/syntax/ClassnameTypeSpecifier.hack index 8661c69dc..d95b73094 100644 --- a/codegen/syntax/ClassnameTypeSpecifier.hack +++ b/codegen/syntax/ClassnameTypeSpecifier.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<940b4d1283c6d974b2cf6f65a60e33f5>> + * @generated SignedSource<<28ff491307c635abc18664bf1714f96d>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -16,14 +16,14 @@ final class ClassnameTypeSpecifier extends Node implements ITypeSpecifier { private ClassnameToken $_keyword; private ?LessThanToken $_left_angle; - private ?ITypeSpecifier $_type; + private ?Node $_type; private ?Node $_trailing_comma; private ?GreaterThanToken $_right_angle; public function __construct( ClassnameToken $keyword, ?LessThanToken $left_angle, - ?ITypeSpecifier $type, + ?Node $type, ?Node $trailing_comma, ?GreaterThanToken $right_angle, ?__Private\SourceRef $source_ref = null, @@ -68,7 +68,7 @@ final class ClassnameTypeSpecifier extends Node implements ITypeSpecifier { $file, $offset, $source, - 'ITypeSpecifier', + 'Node', ); $offset += $type?->getWidth() ?? 0; $trailing_comma = Node::fromJSON( @@ -146,7 +146,7 @@ final class ClassnameTypeSpecifier extends Node implements ITypeSpecifier { return new static( $keyword as ClassnameToken, $left_angle as ?LessThanToken, - $type as ?ITypeSpecifier, + $type as ?Node, $trailing_comma as ?Node, $right_angle as ?GreaterThanToken, ); @@ -226,7 +226,7 @@ final class ClassnameTypeSpecifier extends Node implements ITypeSpecifier { return $this->_type; } - public function withType(?ITypeSpecifier $value): this { + public function withType(?Node $value): this { if ($value === $this->_type) { return $this; } @@ -244,16 +244,18 @@ final class ClassnameTypeSpecifier extends Node implements ITypeSpecifier { } /** - * @return GenericTypeSpecifier | null | SimpleTypeSpecifier | TypeConstant + * @return GenericTypeSpecifier | null | SimpleTypeSpecifier | TypeConstant | + * TypeRefinement */ - public function getType(): ?ITypeSpecifier { + public function getType(): ?Node { return $this->_type; } /** - * @return GenericTypeSpecifier | SimpleTypeSpecifier | TypeConstant + * @return GenericTypeSpecifier | SimpleTypeSpecifier | TypeConstant | + * TypeRefinement */ - public function getTypex(): ITypeSpecifier { + public function getTypex(): Node { return TypeAssert\not_null($this->getType()); } diff --git a/codegen/syntax/ClosureParameterTypeSpecifier.hack b/codegen/syntax/ClosureParameterTypeSpecifier.hack index cf7f8e7e2..f76750629 100644 --- a/codegen/syntax/ClosureParameterTypeSpecifier.hack +++ b/codegen/syntax/ClosureParameterTypeSpecifier.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<49b2045c7d6bc20d1fcc1b8ae20c73af>> + * @generated SignedSource<> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -192,18 +192,18 @@ final class ClosureParameterTypeSpecifier } /** - * @return AttributizedSpecifier | ClosureTypeSpecifier | - * GenericTypeSpecifier | NullableTypeSpecifier | SimpleTypeSpecifier | - * TupleTypeSpecifier | TypeConstant + * @return AttributizedSpecifier | ClosureTypeSpecifier | DarrayTypeSpecifier + * | DictionaryTypeSpecifier | GenericTypeSpecifier | NullableTypeSpecifier | + * SimpleTypeSpecifier | TupleTypeSpecifier | TypeConstant */ public function getType(): ITypeSpecifier { return TypeAssert\instance_of(ITypeSpecifier::class, $this->_type); } /** - * @return AttributizedSpecifier | ClosureTypeSpecifier | - * GenericTypeSpecifier | NullableTypeSpecifier | SimpleTypeSpecifier | - * TupleTypeSpecifier | TypeConstant + * @return AttributizedSpecifier | ClosureTypeSpecifier | DarrayTypeSpecifier + * | DictionaryTypeSpecifier | GenericTypeSpecifier | NullableTypeSpecifier | + * SimpleTypeSpecifier | TupleTypeSpecifier | TypeConstant */ public function getTypex(): ITypeSpecifier { return $this->getType(); diff --git a/codegen/syntax/ClosureTypeSpecifier.hack b/codegen/syntax/ClosureTypeSpecifier.hack index b509b90a4..0587dd117 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<<9c84879ef1b8682f02bbf8aafc171109>> + * @generated SignedSource<<0f788451c8a0501a9fe1150e554018bf>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -23,7 +23,7 @@ final class ClosureTypeSpecifier extends Node implements ITypeSpecifier { private ?Contexts $_contexts; private ColonToken $_colon; private ?ReadonlyToken $_readonly_return; - private ITypeSpecifier $_return_type; + private Node $_return_type; private RightParenToken $_outer_right_paren; public function __construct( @@ -36,7 +36,7 @@ final class ClosureTypeSpecifier extends Node implements ITypeSpecifier { ?Contexts $contexts, ColonToken $colon, ?ReadonlyToken $readonly_return, - ITypeSpecifier $return_type, + Node $return_type, RightParenToken $outer_right_paren, ?__Private\SourceRef $source_ref = null, ) { @@ -148,7 +148,7 @@ final class ClosureTypeSpecifier extends Node implements ITypeSpecifier { $file, $offset, $source, - 'ITypeSpecifier', + 'Node', ); $return_type = $return_type as nonnull; $offset += $return_type->getWidth(); @@ -250,7 +250,7 @@ final class ClosureTypeSpecifier extends Node implements ITypeSpecifier { $contexts as ?Contexts, $colon as ColonToken, $readonly_return as ?ReadonlyToken, - $return_type as ITypeSpecifier, + $return_type as Node, $outer_right_paren as RightParenToken, ); } @@ -637,7 +637,7 @@ final class ClosureTypeSpecifier extends Node implements ITypeSpecifier { return $this->_return_type; } - public function withReturnType(ITypeSpecifier $value): this { + public function withReturnType(Node $value): this { if ($value === $this->_return_type) { return $this; } @@ -662,17 +662,19 @@ final class ClosureTypeSpecifier extends Node implements ITypeSpecifier { /** * @return ClosureTypeSpecifier | GenericTypeSpecifier | LikeTypeSpecifier | - * NullableTypeSpecifier | SimpleTypeSpecifier | VectorTypeSpecifier + * NullableTypeSpecifier | SimpleTypeSpecifier | TypeRefinement | + * VectorTypeSpecifier */ - public function getReturnType(): ITypeSpecifier { - return TypeAssert\instance_of(ITypeSpecifier::class, $this->_return_type); + public function getReturnType(): Node { + return $this->_return_type; } /** * @return ClosureTypeSpecifier | GenericTypeSpecifier | LikeTypeSpecifier | - * NullableTypeSpecifier | SimpleTypeSpecifier | VectorTypeSpecifier + * NullableTypeSpecifier | SimpleTypeSpecifier | TypeRefinement | + * VectorTypeSpecifier */ - public function getReturnTypex(): ITypeSpecifier { + public function getReturnTypex(): Node { return $this->getReturnType(); } diff --git a/codegen/syntax/ConstructorCall.hack b/codegen/syntax/ConstructorCall.hack index dfed48072..43fec52e6 100644 --- a/codegen/syntax/ConstructorCall.hack +++ b/codegen/syntax/ConstructorCall.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -235,6 +235,7 @@ final class ConstructorCall extends Node { * NodeList> | * NodeList> | * NodeList> | + * NodeList> | * NodeList> | * NodeList> | * NodeList> | @@ -265,6 +266,7 @@ final class ConstructorCall extends Node { * NodeList> | * NodeList> | * NodeList> | + * NodeList> | * NodeList> | * NodeList> | * NodeList> | diff --git a/codegen/syntax/DoStatement.hack b/codegen/syntax/DoStatement.hack index 7adaf7cc7..e02d5149e 100644 --- a/codegen/syntax/DoStatement.hack +++ b/codegen/syntax/DoStatement.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<24321f71e828648d2d96dce6c09f971a>> + * @generated SignedSource<<3bb44d055612de73057a24db5f93ef3f>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -355,16 +355,16 @@ final class DoStatement } /** - * @return BinaryExpression | LiteralExpression | SubscriptExpression | - * VariableExpression + * @return BinaryExpression | FunctionCallExpression | LiteralExpression | + * SubscriptExpression | VariableExpression */ public function getCondition(): IExpression { return TypeAssert\instance_of(IExpression::class, $this->_condition); } /** - * @return BinaryExpression | LiteralExpression | SubscriptExpression | - * VariableExpression + * @return BinaryExpression | FunctionCallExpression | LiteralExpression | + * SubscriptExpression | VariableExpression */ public function getConditionx(): IExpression { return $this->getCondition(); diff --git a/codegen/syntax/EnumClassDeclaration.hack b/codegen/syntax/EnumClassDeclaration.hack index dc47a5dc3..f9d23cfb5 100644 --- a/codegen/syntax/EnumClassDeclaration.hack +++ b/codegen/syntax/EnumClassDeclaration.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<71ee494596dad01a0be73d16ce53f8f8>> + * @generated SignedSource<> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -15,7 +15,7 @@ final class EnumClassDeclaration extends Node { const string SYNTAX_KIND = 'enum_class_declaration'; private ?OldAttributeSpecification $_attribute_spec; - private ?NodeList $_modifiers; + private ?NodeList $_modifiers; private EnumToken $_enum_keyword; private ClassToken $_class_keyword; private NameToken $_name; @@ -29,7 +29,7 @@ final class EnumClassDeclaration extends Node { public function __construct( ?OldAttributeSpecification $attribute_spec, - ?NodeList $modifiers, + ?NodeList $modifiers, EnumToken $enum_keyword, ClassToken $class_keyword, NameToken $name, @@ -81,7 +81,7 @@ final class EnumClassDeclaration extends Node { $file, $offset, $source, - 'NodeList', + 'NodeList', ); $offset += $modifiers?->getWidth() ?? 0; $enum_keyword = Node::fromJSON( @@ -258,7 +258,7 @@ final class EnumClassDeclaration extends Node { } return new static( $attribute_spec as ?OldAttributeSpecification, - /* HH_FIXME[4110] ?NodeList may not be enforceable */ $modifiers, + /* HH_FIXME[4110] ?NodeList may not be enforceable */ $modifiers, $enum_keyword as EnumToken, $class_keyword as ClassToken, $name as NameToken, @@ -318,7 +318,7 @@ final class EnumClassDeclaration extends Node { return $this->_modifiers; } - public function withModifiers(?NodeList $value): this { + public function withModifiers(?NodeList $value): this { if ($value === $this->_modifiers) { return $this; } @@ -343,18 +343,16 @@ final class EnumClassDeclaration extends Node { } /** - * @return NodeList | NodeList | - * NodeList | null + * @return NodeList | null */ - public function getModifiers(): ?NodeList { + public function getModifiers(): ?NodeList { return $this->_modifiers; } /** - * @return NodeList | NodeList | - * NodeList + * @return NodeList */ - public function getModifiersx(): NodeList { + public function getModifiersx(): NodeList { return TypeAssert\not_null($this->getModifiers()); } diff --git a/codegen/syntax/EnumDeclaration.hack b/codegen/syntax/EnumDeclaration.hack index e1931d82e..82dc3477a 100644 --- a/codegen/syntax/EnumDeclaration.hack +++ b/codegen/syntax/EnumDeclaration.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<<23c47098179517a5b778b258f67ac93d>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -15,7 +15,7 @@ final class EnumDeclaration extends Node implements IHasAttributeSpec { const string SYNTAX_KIND = 'enum_declaration'; private ?OldAttributeSpecification $_attribute_spec; - private ?NodeList $_modifiers; + private ?Node $_modifiers; private EnumToken $_keyword; private NameToken $_name; private ColonToken $_colon; @@ -28,7 +28,7 @@ final class EnumDeclaration extends Node implements IHasAttributeSpec { public function __construct( ?OldAttributeSpecification $attribute_spec, - ?NodeList $modifiers, + ?Node $modifiers, EnumToken $keyword, NameToken $name, ColonToken $colon, @@ -76,7 +76,7 @@ final class EnumDeclaration extends Node implements IHasAttributeSpec { $file, $offset, $source, - 'NodeList', + 'Node', ); $offset += $modifiers?->getWidth() ?? 0; $keyword = Node::fromJSON( @@ -239,7 +239,7 @@ final class EnumDeclaration extends Node implements IHasAttributeSpec { } return new static( $attribute_spec as ?OldAttributeSpecification, - /* HH_FIXME[4110] ?NodeList may not be enforceable */ $modifiers, + $modifiers as ?Node, $keyword as EnumToken, $name as NameToken, $colon as ColonToken, @@ -297,7 +297,7 @@ final class EnumDeclaration extends Node implements IHasAttributeSpec { return $this->_modifiers; } - public function withModifiers(?NodeList $value): this { + public function withModifiers(?Node $value): this { if ($value === $this->_modifiers) { return $this; } @@ -321,16 +321,16 @@ final class EnumDeclaration extends Node implements IHasAttributeSpec { } /** - * @return NodeList | null + * @return null */ - public function getModifiers(): ?NodeList { + public function getModifiers(): ?Node { return $this->_modifiers; } /** - * @return NodeList + * @return */ - public function getModifiersx(): NodeList { + public function getModifiersx(): Node { return TypeAssert\not_null($this->getModifiers()); } @@ -485,14 +485,18 @@ final class EnumDeclaration extends Node implements IHasAttributeSpec { } /** - * @return ClassnameTypeSpecifier | GenericTypeSpecifier | SimpleTypeSpecifier + * @return ClassnameTypeSpecifier | ClosureTypeSpecifier | + * DictionaryTypeSpecifier | GenericTypeSpecifier | KeysetTypeSpecifier | + * NullableTypeSpecifier | SimpleTypeSpecifier | VectorTypeSpecifier */ public function getBase(): ITypeSpecifier { return TypeAssert\instance_of(ITypeSpecifier::class, $this->_base); } /** - * @return ClassnameTypeSpecifier | GenericTypeSpecifier | SimpleTypeSpecifier + * @return ClassnameTypeSpecifier | ClosureTypeSpecifier | + * DictionaryTypeSpecifier | GenericTypeSpecifier | KeysetTypeSpecifier | + * NullableTypeSpecifier | SimpleTypeSpecifier | VectorTypeSpecifier */ public function getBasex(): ITypeSpecifier { return $this->getBase(); diff --git a/codegen/syntax/ExpressionStatement.hack b/codegen/syntax/ExpressionStatement.hack index 1eeb1d2f0..a91916e4c 100644 --- a/codegen/syntax/ExpressionStatement.hack +++ b/codegen/syntax/ExpressionStatement.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<<1194a0d59cc75e69360ae0daf491bc86>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -117,10 +117,11 @@ final class ExpressionStatement extends Node implements IStatement { * FunctionPointerExpression | InclusionExpression | IsExpression | * IssetExpression | LambdaExpression | LiteralExpression | * MemberSelectionExpression | null | ObjectCreationExpression | - * PostfixUnaryExpression | PrefixUnaryExpression | + * PostfixUnaryExpression | PrefixUnaryExpression | PrefixedCodeExpression | * SafeMemberSelectionExpression | ScopeResolutionExpression | - * SubscriptExpression | NameToken | VariableExpression | - * VarrayIntrinsicExpression | XHPExpression | YieldExpression + * ShapeExpression | SubscriptExpression | NameToken | VariableExpression | + * VarrayIntrinsicExpression | VectorIntrinsicExpression | XHPExpression | + * YieldExpression */ public function getExpression(): ?IExpression { return $this->_expression; @@ -133,10 +134,11 @@ final class ExpressionStatement extends Node implements IStatement { * FunctionPointerExpression | InclusionExpression | IsExpression | * IssetExpression | LambdaExpression | LiteralExpression | * MemberSelectionExpression | ObjectCreationExpression | - * PostfixUnaryExpression | PrefixUnaryExpression | + * PostfixUnaryExpression | PrefixUnaryExpression | PrefixedCodeExpression | * SafeMemberSelectionExpression | ScopeResolutionExpression | - * SubscriptExpression | NameToken | VariableExpression | - * VarrayIntrinsicExpression | XHPExpression | YieldExpression + * ShapeExpression | SubscriptExpression | NameToken | VariableExpression | + * VarrayIntrinsicExpression | VectorIntrinsicExpression | XHPExpression | + * YieldExpression */ public function getExpressionx(): IExpression { return TypeAssert\not_null($this->getExpression()); diff --git a/codegen/syntax/FunctionCallExpression.hack b/codegen/syntax/FunctionCallExpression.hack index 493a16875..635b150dc 100644 --- a/codegen/syntax/FunctionCallExpression.hack +++ b/codegen/syntax/FunctionCallExpression.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<<18913689b7721adc5fd92a1d0453d818>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -175,9 +175,9 @@ final class FunctionCallExpression } /** - * @return function_call_expression | member_selection_expression | - * parenthesized_expression | qualified_name | - * safe_member_selection_expression | scope_resolution_expression | + * @return anonymous_function | function_call_expression | lambda_expression + * | member_selection_expression | parenthesized_expression | qualified_name + * | safe_member_selection_expression | scope_resolution_expression | * subscript_expression | token:name | variable */ public function getReceiver(): Node { @@ -185,9 +185,9 @@ final class FunctionCallExpression } /** - * @return function_call_expression | member_selection_expression | - * parenthesized_expression | qualified_name | - * safe_member_selection_expression | scope_resolution_expression | + * @return anonymous_function | function_call_expression | lambda_expression + * | member_selection_expression | parenthesized_expression | qualified_name + * | safe_member_selection_expression | scope_resolution_expression | * subscript_expression | token:name | variable */ public function getReceiverx(): Node { diff --git a/codegen/syntax/FunctionDeclarationHeader.hack b/codegen/syntax/FunctionDeclarationHeader.hack index 1729471ae..b23be8a98 100644 --- a/codegen/syntax/FunctionDeclarationHeader.hack +++ b/codegen/syntax/FunctionDeclarationHeader.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<24665462d5c5e66ed6bc35d92fc9b6b1>> + * @generated SignedSource<<35b1aac763c199d6762a35516e8913ac>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -24,7 +24,7 @@ final class FunctionDeclarationHeader extends Node { private ?Contexts $_contexts; private ?ColonToken $_colon; private ?ReadonlyToken $_readonly_return; - private ?ITypeSpecifier $_type; + private ?Node $_type; private ?WhereClause $_where_clause; public function __construct( @@ -38,7 +38,7 @@ final class FunctionDeclarationHeader extends Node { ?Contexts $contexts, ?ColonToken $colon, ?ReadonlyToken $readonly_return, - ?ITypeSpecifier $type, + ?Node $type, ?WhereClause $where_clause, ?__Private\SourceRef $source_ref = null, ) { @@ -158,7 +158,7 @@ final class FunctionDeclarationHeader extends Node { $file, $offset, $source, - 'ITypeSpecifier', + 'Node', ); $offset += $type?->getWidth() ?? 0; $where_clause = Node::fromJSON( @@ -268,7 +268,7 @@ final class FunctionDeclarationHeader extends Node { $contexts as ?Contexts, $colon as ?ColonToken, $readonly_return as ?ReadonlyToken, - $type as ?ITypeSpecifier, + $type as ?Node, $where_clause as ?WhereClause, ); } @@ -303,9 +303,9 @@ final class FunctionDeclarationHeader extends Node { /** * @return NodeList | NodeList | NodeList | - * NodeList | NodeList | NodeList | - * NodeList | NodeList | NodeList - * | NodeList | null + * NodeList | NodeList | NodeList | + * NodeList | NodeList | NodeList | + * null */ public function getModifiers(): ?NodeList { return $this->_modifiers; @@ -313,9 +313,8 @@ final class FunctionDeclarationHeader extends Node { /** * @return NodeList | NodeList | NodeList | - * NodeList | NodeList | NodeList | - * NodeList | NodeList | NodeList - * | NodeList + * NodeList | NodeList | NodeList | + * NodeList | NodeList | NodeList */ public function getModifiersx(): NodeList { return TypeAssert\not_null($this->getModifiers()); @@ -707,7 +706,7 @@ final class FunctionDeclarationHeader extends Node { return $this->_type; } - public function withType(?ITypeSpecifier $value): this { + public function withType(?Node $value): this { if ($value === $this->_type) { return $this; } @@ -736,10 +735,10 @@ final class FunctionDeclarationHeader extends Node { * ClosureTypeSpecifier | DarrayTypeSpecifier | DictionaryTypeSpecifier | * GenericTypeSpecifier | KeysetTypeSpecifier | LikeTypeSpecifier | null | * NullableTypeSpecifier | ShapeTypeSpecifier | SimpleTypeSpecifier | - * NoreturnToken | TupleTypeSpecifier | TypeConstant | VarrayTypeSpecifier | - * VectorTypeSpecifier + * NoreturnToken | TupleTypeSpecifier | TypeConstant | TypeRefinement | + * VarrayTypeSpecifier | VectorTypeSpecifier */ - public function getType(): ?ITypeSpecifier { + public function getType(): ?Node { return $this->_type; } @@ -748,10 +747,10 @@ final class FunctionDeclarationHeader extends Node { * ClosureTypeSpecifier | DarrayTypeSpecifier | DictionaryTypeSpecifier | * GenericTypeSpecifier | KeysetTypeSpecifier | LikeTypeSpecifier | * NullableTypeSpecifier | ShapeTypeSpecifier | SimpleTypeSpecifier | - * NoreturnToken | TupleTypeSpecifier | TypeConstant | VarrayTypeSpecifier | - * VectorTypeSpecifier + * NoreturnToken | TupleTypeSpecifier | TypeConstant | TypeRefinement | + * VarrayTypeSpecifier | VectorTypeSpecifier */ - public function getTypex(): ITypeSpecifier { + public function getTypex(): Node { return TypeAssert\not_null($this->getType()); } diff --git a/codegen/syntax/IsExpression.hack b/codegen/syntax/IsExpression.hack index d430fc227..9ccab9175 100644 --- a/codegen/syntax/IsExpression.hack +++ b/codegen/syntax/IsExpression.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<9e2c204d160aa1624c9fe37b3674eb1a>> + * @generated SignedSource<<39d0ddf0080da50f0c3abdad45e5544c>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -129,8 +129,8 @@ final class IsExpression extends Node implements ILambdaBody, IExpression { } /** - * @return AnonymousFunction | FunctionCallExpression | LiteralExpression | - * MemberSelectionExpression | ObjectCreationExpression | + * @return AnonymousFunction | AsExpression | FunctionCallExpression | + * LiteralExpression | MemberSelectionExpression | ObjectCreationExpression | * ParenthesizedExpression | PipeVariableExpression | PrefixUnaryExpression | * ScopeResolutionExpression | ShapeExpression | SubscriptExpression | * TupleExpression | VariableExpression @@ -140,8 +140,8 @@ final class IsExpression extends Node implements ILambdaBody, IExpression { } /** - * @return AnonymousFunction | FunctionCallExpression | LiteralExpression | - * MemberSelectionExpression | ObjectCreationExpression | + * @return AnonymousFunction | AsExpression | FunctionCallExpression | + * LiteralExpression | MemberSelectionExpression | ObjectCreationExpression | * ParenthesizedExpression | PipeVariableExpression | PrefixUnaryExpression | * ScopeResolutionExpression | ShapeExpression | SubscriptExpression | * TupleExpression | VariableExpression diff --git a/codegen/syntax/LikeTypeSpecifier.hack b/codegen/syntax/LikeTypeSpecifier.hack index 4dc1af8b3..9919e8c27 100644 --- a/codegen/syntax/LikeTypeSpecifier.hack +++ b/codegen/syntax/LikeTypeSpecifier.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<2287ac09d077d0465c867885f27c6458>> + * @generated SignedSource<<941aa8f9de40fb233269411d3d530084>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -137,7 +137,8 @@ final class LikeTypeSpecifier extends Node implements ITypeSpecifier { /** * @return DarrayTypeSpecifier | DictionaryTypeSpecifier | * GenericTypeSpecifier | LikeTypeSpecifier | SimpleTypeSpecifier | - * TypeConstant | VarrayTypeSpecifier | VectorTypeSpecifier + * SoftTypeSpecifier | TypeConstant | VarrayTypeSpecifier | + * VectorTypeSpecifier */ public function getType(): ITypeSpecifier { return TypeAssert\instance_of(ITypeSpecifier::class, $this->_type); @@ -146,7 +147,8 @@ final class LikeTypeSpecifier extends Node implements ITypeSpecifier { /** * @return DarrayTypeSpecifier | DictionaryTypeSpecifier | * GenericTypeSpecifier | LikeTypeSpecifier | SimpleTypeSpecifier | - * TypeConstant | VarrayTypeSpecifier | VectorTypeSpecifier + * SoftTypeSpecifier | TypeConstant | VarrayTypeSpecifier | + * VectorTypeSpecifier */ public function getTypex(): ITypeSpecifier { return $this->getType(); diff --git a/codegen/syntax/ModuleDeclaration.hack b/codegen/syntax/ModuleDeclaration.hack index 28b0e584f..59829e927 100644 --- a/codegen/syntax/ModuleDeclaration.hack +++ b/codegen/syntax/ModuleDeclaration.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<066bf009dfdf1ba8c04e96cc1482b4bb>> + * @generated SignedSource<<04ce291c75a90778876e136f06fb298d>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -14,19 +14,23 @@ final class ModuleDeclaration extends Node { const string SYNTAX_KIND = 'module_declaration'; - private ?OldAttributeSpecification $_attribute_spec; + private OldAttributeSpecification $_attribute_spec; private NewToken $_new_keyword; private ModuleToken $_module_keyword; - private NameToken $_name; + private ModuleName $_name; private LeftBraceToken $_left_brace; + private ?Node $_exports; + private ?Node $_imports; private RightBraceToken $_right_brace; public function __construct( - ?OldAttributeSpecification $attribute_spec, + OldAttributeSpecification $attribute_spec, NewToken $new_keyword, ModuleToken $module_keyword, - NameToken $name, + ModuleName $name, LeftBraceToken $left_brace, + ?Node $exports, + ?Node $imports, RightBraceToken $right_brace, ?__Private\SourceRef $source_ref = null, ) { @@ -35,6 +39,8 @@ final class ModuleDeclaration extends Node { $this->_module_keyword = $module_keyword; $this->_name = $name; $this->_left_brace = $left_brace; + $this->_exports = $exports; + $this->_imports = $imports; $this->_right_brace = $right_brace; parent::__construct($source_ref); } @@ -49,14 +55,14 @@ final class ModuleDeclaration extends Node { ): this { $offset = $initial_offset; $attribute_spec = Node::fromJSON( - ($json['module_declaration_attribute_spec'] ?? dict['kind' => 'missing']) - as dict<_, _>, + ($json['module_declaration_attribute_spec']) as dict<_, _>, $file, $offset, $source, 'OldAttributeSpecification', ); - $offset += $attribute_spec?->getWidth() ?? 0; + $attribute_spec = $attribute_spec as nonnull; + $offset += $attribute_spec->getWidth(); $new_keyword = Node::fromJSON( ($json['module_declaration_new_keyword']) as dict<_, _>, $file, @@ -80,7 +86,7 @@ final class ModuleDeclaration extends Node { $file, $offset, $source, - 'NameToken', + 'ModuleName', ); $name = $name as nonnull; $offset += $name->getWidth(); @@ -93,6 +99,24 @@ final class ModuleDeclaration extends Node { ); $left_brace = $left_brace as nonnull; $offset += $left_brace->getWidth(); + $exports = Node::fromJSON( + ($json['module_declaration_exports'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $exports?->getWidth() ?? 0; + $imports = Node::fromJSON( + ($json['module_declaration_imports'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $imports?->getWidth() ?? 0; $right_brace = Node::fromJSON( ($json['module_declaration_right_brace']) as dict<_, _>, $file, @@ -114,6 +138,8 @@ final class ModuleDeclaration extends Node { /* HH_IGNORE_ERROR[4110] */ $module_keyword, /* HH_IGNORE_ERROR[4110] */ $name, /* HH_IGNORE_ERROR[4110] */ $left_brace, + /* HH_IGNORE_ERROR[4110] */ $exports, + /* HH_IGNORE_ERROR[4110] */ $imports, /* HH_IGNORE_ERROR[4110] */ $right_brace, $source_ref, ); @@ -127,6 +153,8 @@ final class ModuleDeclaration extends Node { 'module_keyword' => $this->_module_keyword, 'name' => $this->_name, 'left_brace' => $this->_left_brace, + 'exports' => $this->_exports, + 'imports' => $this->_imports, 'right_brace' => $this->_right_brace, ] |> Dict\filter_nulls($$); @@ -138,13 +166,15 @@ final class ModuleDeclaration extends Node { vec $parents = vec[], ): this { $parents[] = $this; - $attribute_spec = $this->_attribute_spec === null - ? null - : $rewriter($this->_attribute_spec, $parents); + $attribute_spec = $rewriter($this->_attribute_spec, $parents); $new_keyword = $rewriter($this->_new_keyword, $parents); $module_keyword = $rewriter($this->_module_keyword, $parents); $name = $rewriter($this->_name, $parents); $left_brace = $rewriter($this->_left_brace, $parents); + $exports = + $this->_exports === null ? null : $rewriter($this->_exports, $parents); + $imports = + $this->_imports === null ? null : $rewriter($this->_imports, $parents); $right_brace = $rewriter($this->_right_brace, $parents); if ( $attribute_spec === $this->_attribute_spec && @@ -152,16 +182,20 @@ final class ModuleDeclaration extends Node { $module_keyword === $this->_module_keyword && $name === $this->_name && $left_brace === $this->_left_brace && + $exports === $this->_exports && + $imports === $this->_imports && $right_brace === $this->_right_brace ) { return $this; } return new static( - $attribute_spec as ?OldAttributeSpecification, + $attribute_spec as OldAttributeSpecification, $new_keyword as NewToken, $module_keyword as ModuleToken, - $name as NameToken, + $name as ModuleName, $left_brace as LeftBraceToken, + $exports as ?Node, + $imports as ?Node, $right_brace as RightBraceToken, ); } @@ -170,7 +204,7 @@ final class ModuleDeclaration extends Node { return $this->_attribute_spec; } - public function withAttributeSpec(?OldAttributeSpecification $value): this { + public function withAttributeSpec(OldAttributeSpecification $value): this { if ($value === $this->_attribute_spec) { return $this; } @@ -180,26 +214,31 @@ final class ModuleDeclaration extends Node { $this->_module_keyword, $this->_name, $this->_left_brace, + $this->_exports, + $this->_imports, $this->_right_brace, ); } public function hasAttributeSpec(): bool { - return $this->_attribute_spec !== null; + return true; } /** - * @return null | OldAttributeSpecification + * @return OldAttributeSpecification */ - public function getAttributeSpec(): ?OldAttributeSpecification { - return $this->_attribute_spec; + public function getAttributeSpec(): OldAttributeSpecification { + return TypeAssert\instance_of( + OldAttributeSpecification::class, + $this->_attribute_spec, + ); } /** * @return OldAttributeSpecification */ public function getAttributeSpecx(): OldAttributeSpecification { - return TypeAssert\not_null($this->getAttributeSpec()); + return $this->getAttributeSpec(); } public function getNewKeywordUNTYPED(): ?Node { @@ -216,6 +255,8 @@ final class ModuleDeclaration extends Node { $this->_module_keyword, $this->_name, $this->_left_brace, + $this->_exports, + $this->_imports, $this->_right_brace, ); } @@ -252,6 +293,8 @@ final class ModuleDeclaration extends Node { $value, $this->_name, $this->_left_brace, + $this->_exports, + $this->_imports, $this->_right_brace, ); } @@ -278,7 +321,7 @@ final class ModuleDeclaration extends Node { return $this->_name; } - public function withName(NameToken $value): this { + public function withName(ModuleName $value): this { if ($value === $this->_name) { return $this; } @@ -288,6 +331,8 @@ final class ModuleDeclaration extends Node { $this->_module_keyword, $value, $this->_left_brace, + $this->_exports, + $this->_imports, $this->_right_brace, ); } @@ -297,16 +342,16 @@ final class ModuleDeclaration extends Node { } /** - * @return NameToken + * @return ModuleName */ - public function getName(): NameToken { - return TypeAssert\instance_of(NameToken::class, $this->_name); + public function getName(): ModuleName { + return TypeAssert\instance_of(ModuleName::class, $this->_name); } /** - * @return NameToken + * @return ModuleName */ - public function getNamex(): NameToken { + public function getNamex(): ModuleName { return $this->getName(); } @@ -324,6 +369,8 @@ final class ModuleDeclaration extends Node { $this->_module_keyword, $this->_name, $value, + $this->_exports, + $this->_imports, $this->_right_brace, ); } @@ -346,6 +393,82 @@ final class ModuleDeclaration extends Node { return $this->getLeftBrace(); } + public function getExportsUNTYPED(): ?Node { + return $this->_exports; + } + + public function withExports(?Node $value): this { + if ($value === $this->_exports) { + return $this; + } + return new static( + $this->_attribute_spec, + $this->_new_keyword, + $this->_module_keyword, + $this->_name, + $this->_left_brace, + $value, + $this->_imports, + $this->_right_brace, + ); + } + + public function hasExports(): bool { + return $this->_exports !== null; + } + + /** + * @return null + */ + public function getExports(): ?Node { + return $this->_exports; + } + + /** + * @return + */ + public function getExportsx(): Node { + return TypeAssert\not_null($this->getExports()); + } + + public function getImportsUNTYPED(): ?Node { + return $this->_imports; + } + + public function withImports(?Node $value): this { + if ($value === $this->_imports) { + return $this; + } + return new static( + $this->_attribute_spec, + $this->_new_keyword, + $this->_module_keyword, + $this->_name, + $this->_left_brace, + $this->_exports, + $value, + $this->_right_brace, + ); + } + + public function hasImports(): bool { + return $this->_imports !== null; + } + + /** + * @return null + */ + public function getImports(): ?Node { + return $this->_imports; + } + + /** + * @return + */ + public function getImportsx(): Node { + return TypeAssert\not_null($this->getImports()); + } + public function getRightBraceUNTYPED(): ?Node { return $this->_right_brace; } @@ -360,6 +483,8 @@ final class ModuleDeclaration extends Node { $this->_module_keyword, $this->_name, $this->_left_brace, + $this->_exports, + $this->_imports, $value, ); } diff --git a/codegen/syntax/ModuleExports.hack b/codegen/syntax/ModuleExports.hack new file mode 100644 index 000000000..7a1dc5783 --- /dev/null +++ b/codegen/syntax/ModuleExports.hack @@ -0,0 +1,275 @@ +/** + * This file is generated. Do not modify it manually! + * + * @generated SignedSource<<54f7c7fd94e8ce26e0d0f5e21a2a65ec>> + */ +namespace Facebook\HHAST; +use namespace Facebook\TypeAssert; +use namespace HH\Lib\Dict; +/* HHAST_IGNORE_ALL[5607] 5607 is ignored because of false positives when comparing a generic to a typed value */ +/* HHAST_IGNORE_ALL[5624] HHAST_IGNORE_ALL[5639] 5624 and 5639 are ignored because they insist on using co(tra)variant generics. Could this break external consumers? */ + +<<__ConsistentConstruct>> +final class ModuleExports extends Node { + + const string SYNTAX_KIND = 'module_exports'; + + private ?Node $_exports_keyword; + private ?Node $_left_brace; + private ?Node $_exports; + private ?Node $_right_brace; + + public function __construct( + ?Node $exports_keyword, + ?Node $left_brace, + ?Node $exports, + ?Node $right_brace, + ?__Private\SourceRef $source_ref = null, + ) { + $this->_exports_keyword = $exports_keyword; + $this->_left_brace = $left_brace; + $this->_exports = $exports; + $this->_right_brace = $right_brace; + parent::__construct($source_ref); + } + + <<__Override>> + public static function fromJSON( + dict $json, + string $file, + int $initial_offset, + string $source, + string $_type_hint, + ): this { + $offset = $initial_offset; + $exports_keyword = Node::fromJSON( + ($json['module_exports_exports_keyword'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $exports_keyword?->getWidth() ?? 0; + $left_brace = Node::fromJSON( + ($json['module_exports_left_brace'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $left_brace?->getWidth() ?? 0; + $exports = Node::fromJSON( + ($json['module_exports_exports'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $exports?->getWidth() ?? 0; + $right_brace = Node::fromJSON( + ($json['module_exports_right_brace'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $right_brace?->getWidth() ?? 0; + $source_ref = shape( + 'file' => $file, + 'source' => $source, + 'offset' => $initial_offset, + 'width' => $offset - $initial_offset, + ); + return new static( + /* HH_IGNORE_ERROR[4110] */ $exports_keyword, + /* HH_IGNORE_ERROR[4110] */ $left_brace, + /* HH_IGNORE_ERROR[4110] */ $exports, + /* HH_IGNORE_ERROR[4110] */ $right_brace, + $source_ref, + ); + } + + <<__Override>> + public function getChildren(): dict { + return dict[ + 'exports_keyword' => $this->_exports_keyword, + 'left_brace' => $this->_left_brace, + 'exports' => $this->_exports, + 'right_brace' => $this->_right_brace, + ] + |> Dict\filter_nulls($$); + } + + <<__Override>> + public function rewriteChildren( + (function(Node, vec): Tret) $rewriter, + vec $parents = vec[], + ): this { + $parents[] = $this; + $exports_keyword = $this->_exports_keyword === null + ? null + : $rewriter($this->_exports_keyword, $parents); + $left_brace = $this->_left_brace === null + ? null + : $rewriter($this->_left_brace, $parents); + $exports = + $this->_exports === null ? null : $rewriter($this->_exports, $parents); + $right_brace = $this->_right_brace === null + ? null + : $rewriter($this->_right_brace, $parents); + if ( + $exports_keyword === $this->_exports_keyword && + $left_brace === $this->_left_brace && + $exports === $this->_exports && + $right_brace === $this->_right_brace + ) { + return $this; + } + return new static( + $exports_keyword as ?Node, + $left_brace as ?Node, + $exports as ?Node, + $right_brace as ?Node, + ); + } + + public function getExportsKeywordUNTYPED(): ?Node { + return $this->_exports_keyword; + } + + public function withExportsKeyword(?Node $value): this { + if ($value === $this->_exports_keyword) { + return $this; + } + return new static( + $value, + $this->_left_brace, + $this->_exports, + $this->_right_brace, + ); + } + + public function hasExportsKeyword(): bool { + return $this->_exports_keyword !== null; + } + + /** + * @return unknown + */ + public function getExportsKeyword(): ?Node { + return $this->_exports_keyword; + } + + /** + * @return unknown + */ + public function getExportsKeywordx(): Node { + return TypeAssert\not_null($this->getExportsKeyword()); + } + + public function getLeftBraceUNTYPED(): ?Node { + return $this->_left_brace; + } + + public function withLeftBrace(?Node $value): this { + if ($value === $this->_left_brace) { + return $this; + } + return new static( + $this->_exports_keyword, + $value, + $this->_exports, + $this->_right_brace, + ); + } + + public function hasLeftBrace(): bool { + return $this->_left_brace !== null; + } + + /** + * @return unknown + */ + public function getLeftBrace(): ?Node { + return $this->_left_brace; + } + + /** + * @return unknown + */ + public function getLeftBracex(): Node { + return TypeAssert\not_null($this->getLeftBrace()); + } + + public function getExportsUNTYPED(): ?Node { + return $this->_exports; + } + + public function withExports(?Node $value): this { + if ($value === $this->_exports) { + return $this; + } + return new static( + $this->_exports_keyword, + $this->_left_brace, + $value, + $this->_right_brace, + ); + } + + public function hasExports(): bool { + return $this->_exports !== null; + } + + /** + * @return unknown + */ + public function getExports(): ?Node { + return $this->_exports; + } + + /** + * @return unknown + */ + public function getExportsx(): Node { + return TypeAssert\not_null($this->getExports()); + } + + public function getRightBraceUNTYPED(): ?Node { + return $this->_right_brace; + } + + public function withRightBrace(?Node $value): this { + if ($value === $this->_right_brace) { + return $this; + } + return new static( + $this->_exports_keyword, + $this->_left_brace, + $this->_exports, + $value, + ); + } + + public function hasRightBrace(): bool { + return $this->_right_brace !== null; + } + + /** + * @return unknown + */ + public function getRightBrace(): ?Node { + return $this->_right_brace; + } + + /** + * @return unknown + */ + public function getRightBracex(): Node { + return TypeAssert\not_null($this->getRightBrace()); + } +} diff --git a/codegen/syntax/ModuleImports.hack b/codegen/syntax/ModuleImports.hack new file mode 100644 index 000000000..a1ac1e8c7 --- /dev/null +++ b/codegen/syntax/ModuleImports.hack @@ -0,0 +1,275 @@ +/** + * This file is generated. Do not modify it manually! + * + * @generated SignedSource<<4cce7c2ecfcdefa1bd56e2cbd86295cd>> + */ +namespace Facebook\HHAST; +use namespace Facebook\TypeAssert; +use namespace HH\Lib\Dict; +/* HHAST_IGNORE_ALL[5607] 5607 is ignored because of false positives when comparing a generic to a typed value */ +/* HHAST_IGNORE_ALL[5624] HHAST_IGNORE_ALL[5639] 5624 and 5639 are ignored because they insist on using co(tra)variant generics. Could this break external consumers? */ + +<<__ConsistentConstruct>> +final class ModuleImports extends Node { + + const string SYNTAX_KIND = 'module_imports'; + + private ?Node $_imports_keyword; + private ?Node $_left_brace; + private ?Node $_imports; + private ?Node $_right_brace; + + public function __construct( + ?Node $imports_keyword, + ?Node $left_brace, + ?Node $imports, + ?Node $right_brace, + ?__Private\SourceRef $source_ref = null, + ) { + $this->_imports_keyword = $imports_keyword; + $this->_left_brace = $left_brace; + $this->_imports = $imports; + $this->_right_brace = $right_brace; + parent::__construct($source_ref); + } + + <<__Override>> + public static function fromJSON( + dict $json, + string $file, + int $initial_offset, + string $source, + string $_type_hint, + ): this { + $offset = $initial_offset; + $imports_keyword = Node::fromJSON( + ($json['module_imports_imports_keyword'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $imports_keyword?->getWidth() ?? 0; + $left_brace = Node::fromJSON( + ($json['module_imports_left_brace'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $left_brace?->getWidth() ?? 0; + $imports = Node::fromJSON( + ($json['module_imports_imports'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $imports?->getWidth() ?? 0; + $right_brace = Node::fromJSON( + ($json['module_imports_right_brace'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $right_brace?->getWidth() ?? 0; + $source_ref = shape( + 'file' => $file, + 'source' => $source, + 'offset' => $initial_offset, + 'width' => $offset - $initial_offset, + ); + return new static( + /* HH_IGNORE_ERROR[4110] */ $imports_keyword, + /* HH_IGNORE_ERROR[4110] */ $left_brace, + /* HH_IGNORE_ERROR[4110] */ $imports, + /* HH_IGNORE_ERROR[4110] */ $right_brace, + $source_ref, + ); + } + + <<__Override>> + public function getChildren(): dict { + return dict[ + 'imports_keyword' => $this->_imports_keyword, + 'left_brace' => $this->_left_brace, + 'imports' => $this->_imports, + 'right_brace' => $this->_right_brace, + ] + |> Dict\filter_nulls($$); + } + + <<__Override>> + public function rewriteChildren( + (function(Node, vec): Tret) $rewriter, + vec $parents = vec[], + ): this { + $parents[] = $this; + $imports_keyword = $this->_imports_keyword === null + ? null + : $rewriter($this->_imports_keyword, $parents); + $left_brace = $this->_left_brace === null + ? null + : $rewriter($this->_left_brace, $parents); + $imports = + $this->_imports === null ? null : $rewriter($this->_imports, $parents); + $right_brace = $this->_right_brace === null + ? null + : $rewriter($this->_right_brace, $parents); + if ( + $imports_keyword === $this->_imports_keyword && + $left_brace === $this->_left_brace && + $imports === $this->_imports && + $right_brace === $this->_right_brace + ) { + return $this; + } + return new static( + $imports_keyword as ?Node, + $left_brace as ?Node, + $imports as ?Node, + $right_brace as ?Node, + ); + } + + public function getImportsKeywordUNTYPED(): ?Node { + return $this->_imports_keyword; + } + + public function withImportsKeyword(?Node $value): this { + if ($value === $this->_imports_keyword) { + return $this; + } + return new static( + $value, + $this->_left_brace, + $this->_imports, + $this->_right_brace, + ); + } + + public function hasImportsKeyword(): bool { + return $this->_imports_keyword !== null; + } + + /** + * @return unknown + */ + public function getImportsKeyword(): ?Node { + return $this->_imports_keyword; + } + + /** + * @return unknown + */ + public function getImportsKeywordx(): Node { + return TypeAssert\not_null($this->getImportsKeyword()); + } + + public function getLeftBraceUNTYPED(): ?Node { + return $this->_left_brace; + } + + public function withLeftBrace(?Node $value): this { + if ($value === $this->_left_brace) { + return $this; + } + return new static( + $this->_imports_keyword, + $value, + $this->_imports, + $this->_right_brace, + ); + } + + public function hasLeftBrace(): bool { + return $this->_left_brace !== null; + } + + /** + * @return unknown + */ + public function getLeftBrace(): ?Node { + return $this->_left_brace; + } + + /** + * @return unknown + */ + public function getLeftBracex(): Node { + return TypeAssert\not_null($this->getLeftBrace()); + } + + public function getImportsUNTYPED(): ?Node { + return $this->_imports; + } + + public function withImports(?Node $value): this { + if ($value === $this->_imports) { + return $this; + } + return new static( + $this->_imports_keyword, + $this->_left_brace, + $value, + $this->_right_brace, + ); + } + + public function hasImports(): bool { + return $this->_imports !== null; + } + + /** + * @return unknown + */ + public function getImports(): ?Node { + return $this->_imports; + } + + /** + * @return unknown + */ + public function getImportsx(): Node { + return TypeAssert\not_null($this->getImports()); + } + + public function getRightBraceUNTYPED(): ?Node { + return $this->_right_brace; + } + + public function withRightBrace(?Node $value): this { + if ($value === $this->_right_brace) { + return $this; + } + return new static( + $this->_imports_keyword, + $this->_left_brace, + $this->_imports, + $value, + ); + } + + public function hasRightBrace(): bool { + return $this->_right_brace !== null; + } + + /** + * @return unknown + */ + public function getRightBrace(): ?Node { + return $this->_right_brace; + } + + /** + * @return unknown + */ + public function getRightBracex(): Node { + return TypeAssert\not_null($this->getRightBrace()); + } +} diff --git a/codegen/syntax/ModuleMembershipDeclaration.hack b/codegen/syntax/ModuleMembershipDeclaration.hack index 8af1eb162..175b9f414 100644 --- a/codegen/syntax/ModuleMembershipDeclaration.hack +++ b/codegen/syntax/ModuleMembershipDeclaration.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<<30ce5c85ba4149a8bac7eb3b682dea3e>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -15,12 +15,12 @@ final class ModuleMembershipDeclaration extends Node { const string SYNTAX_KIND = 'module_membership_declaration'; private ModuleToken $_module_keyword; - private NameToken $_name; + private ModuleName $_name; private SemicolonToken $_semicolon; public function __construct( ModuleToken $module_keyword, - NameToken $name, + ModuleName $name, SemicolonToken $semicolon, ?__Private\SourceRef $source_ref = null, ) { @@ -53,7 +53,7 @@ final class ModuleMembershipDeclaration extends Node { $file, $offset, $source, - 'NameToken', + 'ModuleName', ); $name = $name as nonnull; $offset += $name->getWidth(); @@ -108,7 +108,7 @@ final class ModuleMembershipDeclaration extends Node { } return new static( $module_keyword as ModuleToken, - $name as NameToken, + $name as ModuleName, $semicolon as SemicolonToken, ); } @@ -146,7 +146,7 @@ final class ModuleMembershipDeclaration extends Node { return $this->_name; } - public function withName(NameToken $value): this { + public function withName(ModuleName $value): this { if ($value === $this->_name) { return $this; } @@ -158,16 +158,16 @@ final class ModuleMembershipDeclaration extends Node { } /** - * @return NameToken + * @return ModuleName */ - public function getName(): NameToken { - return TypeAssert\instance_of(NameToken::class, $this->_name); + public function getName(): ModuleName { + return TypeAssert\instance_of(ModuleName::class, $this->_name); } /** - * @return NameToken + * @return ModuleName */ - public function getNamex(): NameToken { + public function getNamex(): ModuleName { return $this->getName(); } diff --git a/codegen/syntax/ModuleName.hack b/codegen/syntax/ModuleName.hack new file mode 100644 index 000000000..13e62d299 --- /dev/null +++ b/codegen/syntax/ModuleName.hack @@ -0,0 +1,105 @@ +/** + * This file is generated. Do not modify it manually! + * + * @generated SignedSource<> + */ +namespace Facebook\HHAST; +use namespace Facebook\TypeAssert; +use namespace HH\Lib\Dict; +/* HHAST_IGNORE_ALL[5607] 5607 is ignored because of false positives when comparing a generic to a typed value */ +/* HHAST_IGNORE_ALL[5624] HHAST_IGNORE_ALL[5639] 5624 and 5639 are ignored because they insist on using co(tra)variant generics. Could this break external consumers? */ + +<<__ConsistentConstruct>> +final class ModuleName extends Node { + + const string SYNTAX_KIND = 'module_name'; + + private NodeList> $_parts; + + public function __construct( + NodeList> $parts, + ?__Private\SourceRef $source_ref = null, + ) { + $this->_parts = $parts; + parent::__construct($source_ref); + } + + <<__Override>> + public static function fromJSON( + dict $json, + string $file, + int $initial_offset, + string $source, + string $_type_hint, + ): this { + $offset = $initial_offset; + $parts = Node::fromJSON( + ($json['module_name_parts']) as dict<_, _>, + $file, + $offset, + $source, + 'NodeList>', + ); + $parts = $parts as nonnull; + $offset += $parts->getWidth(); + $source_ref = shape( + 'file' => $file, + 'source' => $source, + 'offset' => $initial_offset, + 'width' => $offset - $initial_offset, + ); + return new static(/* HH_IGNORE_ERROR[4110] */ $parts, $source_ref); + } + + <<__Override>> + public function getChildren(): dict { + return dict[ + 'parts' => $this->_parts, + ] + |> Dict\filter_nulls($$); + } + + <<__Override>> + public function rewriteChildren( + (function(Node, vec): Tret) $rewriter, + vec $parents = vec[], + ): this { + $parents[] = $this; + $parts = $rewriter($this->_parts, $parents); + if ($parts === $this->_parts) { + return $this; + } + return new static( + /* HH_FIXME[4110] NodeList> may not be enforceable */ $parts, + ); + } + + public function getPartsUNTYPED(): ?Node { + return $this->_parts; + } + + public function withParts(NodeList> $value): this { + if ($value === $this->_parts) { + return $this; + } + return new static($value); + } + + public function hasParts(): bool { + return true; + } + + /** + * @return NodeList> + */ + public function getParts(): NodeList> { + return TypeAssert\instance_of(NodeList::class, $this->_parts); + } + + /** + * @return NodeList> + */ + public function getPartsx(): NodeList> { + return $this->getParts(); + } +} diff --git a/codegen/syntax/NullableTypeSpecifier.hack b/codegen/syntax/NullableTypeSpecifier.hack index 2b85924ef..92eb01eba 100644 --- a/codegen/syntax/NullableTypeSpecifier.hack +++ b/codegen/syntax/NullableTypeSpecifier.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<<56e1e3f1e8b1b13180dce338161b4c7f>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -136,9 +136,10 @@ final class NullableTypeSpecifier extends Node implements ITypeSpecifier { /** * @return ClosureTypeSpecifier | DarrayTypeSpecifier | - * DictionaryTypeSpecifier | GenericTypeSpecifier | LikeTypeSpecifier | - * ShapeTypeSpecifier | SimpleTypeSpecifier | TupleTypeSpecifier | - * TypeConstant | VarrayTypeSpecifier | VectorTypeSpecifier + * DictionaryTypeSpecifier | GenericTypeSpecifier | KeysetTypeSpecifier | + * LikeTypeSpecifier | ShapeTypeSpecifier | SimpleTypeSpecifier | + * SoftTypeSpecifier | TupleTypeSpecifier | TypeConstant | + * VarrayTypeSpecifier | VectorTypeSpecifier */ public function getType(): ITypeSpecifier { return TypeAssert\instance_of(ITypeSpecifier::class, $this->_type); @@ -146,9 +147,10 @@ final class NullableTypeSpecifier extends Node implements ITypeSpecifier { /** * @return ClosureTypeSpecifier | DarrayTypeSpecifier | - * DictionaryTypeSpecifier | GenericTypeSpecifier | LikeTypeSpecifier | - * ShapeTypeSpecifier | SimpleTypeSpecifier | TupleTypeSpecifier | - * TypeConstant | VarrayTypeSpecifier | VectorTypeSpecifier + * DictionaryTypeSpecifier | GenericTypeSpecifier | KeysetTypeSpecifier | + * LikeTypeSpecifier | ShapeTypeSpecifier | SimpleTypeSpecifier | + * SoftTypeSpecifier | TupleTypeSpecifier | TypeConstant | + * VarrayTypeSpecifier | VectorTypeSpecifier */ public function getTypex(): ITypeSpecifier { return $this->getType(); diff --git a/codegen/syntax/PackageDeclaration.hack b/codegen/syntax/PackageDeclaration.hack new file mode 100644 index 000000000..f3ee38347 --- /dev/null +++ b/codegen/syntax/PackageDeclaration.hack @@ -0,0 +1,453 @@ +/** + * This file is generated. Do not modify it manually! + * + * @generated SignedSource<<75d2329eb34236a7ab79901cedc637f9>> + */ +namespace Facebook\HHAST; +use namespace Facebook\TypeAssert; +use namespace HH\Lib\Dict; +/* HHAST_IGNORE_ALL[5607] 5607 is ignored because of false positives when comparing a generic to a typed value */ +/* HHAST_IGNORE_ALL[5624] HHAST_IGNORE_ALL[5639] 5624 and 5639 are ignored because they insist on using co(tra)variant generics. Could this break external consumers? */ + +<<__ConsistentConstruct>> +final class PackageDeclaration extends Node { + + const string SYNTAX_KIND = 'package_declaration'; + + private ?Node $_attribute_spec; + private ?Node $_package_keyword; + private ?Node $_name; + private ?Node $_left_brace; + private ?Node $_uses; + private ?Node $_includes; + private ?Node $_right_brace; + + public function __construct( + ?Node $attribute_spec, + ?Node $package_keyword, + ?Node $name, + ?Node $left_brace, + ?Node $uses, + ?Node $includes, + ?Node $right_brace, + ?__Private\SourceRef $source_ref = null, + ) { + $this->_attribute_spec = $attribute_spec; + $this->_package_keyword = $package_keyword; + $this->_name = $name; + $this->_left_brace = $left_brace; + $this->_uses = $uses; + $this->_includes = $includes; + $this->_right_brace = $right_brace; + parent::__construct($source_ref); + } + + <<__Override>> + public static function fromJSON( + dict $json, + string $file, + int $initial_offset, + string $source, + string $_type_hint, + ): this { + $offset = $initial_offset; + $attribute_spec = Node::fromJSON( + ($json['package_declaration_attribute_spec'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $attribute_spec?->getWidth() ?? 0; + $package_keyword = Node::fromJSON( + ( + $json['package_declaration_package_keyword'] ?? + dict['kind' => 'missing'] + ) as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $package_keyword?->getWidth() ?? 0; + $name = Node::fromJSON( + ($json['package_declaration_name'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $name?->getWidth() ?? 0; + $left_brace = Node::fromJSON( + ($json['package_declaration_left_brace'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $left_brace?->getWidth() ?? 0; + $uses = Node::fromJSON( + ($json['package_declaration_uses'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $uses?->getWidth() ?? 0; + $includes = Node::fromJSON( + ($json['package_declaration_includes'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $includes?->getWidth() ?? 0; + $right_brace = Node::fromJSON( + ($json['package_declaration_right_brace'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $right_brace?->getWidth() ?? 0; + $source_ref = shape( + 'file' => $file, + 'source' => $source, + 'offset' => $initial_offset, + 'width' => $offset - $initial_offset, + ); + return new static( + /* HH_IGNORE_ERROR[4110] */ $attribute_spec, + /* HH_IGNORE_ERROR[4110] */ $package_keyword, + /* HH_IGNORE_ERROR[4110] */ $name, + /* HH_IGNORE_ERROR[4110] */ $left_brace, + /* HH_IGNORE_ERROR[4110] */ $uses, + /* HH_IGNORE_ERROR[4110] */ $includes, + /* HH_IGNORE_ERROR[4110] */ $right_brace, + $source_ref, + ); + } + + <<__Override>> + public function getChildren(): dict { + return dict[ + 'attribute_spec' => $this->_attribute_spec, + 'package_keyword' => $this->_package_keyword, + 'name' => $this->_name, + 'left_brace' => $this->_left_brace, + 'uses' => $this->_uses, + 'includes' => $this->_includes, + 'right_brace' => $this->_right_brace, + ] + |> Dict\filter_nulls($$); + } + + <<__Override>> + public function rewriteChildren( + (function(Node, vec): Tret) $rewriter, + vec $parents = vec[], + ): this { + $parents[] = $this; + $attribute_spec = $this->_attribute_spec === null + ? null + : $rewriter($this->_attribute_spec, $parents); + $package_keyword = $this->_package_keyword === null + ? null + : $rewriter($this->_package_keyword, $parents); + $name = $this->_name === null ? null : $rewriter($this->_name, $parents); + $left_brace = $this->_left_brace === null + ? null + : $rewriter($this->_left_brace, $parents); + $uses = $this->_uses === null ? null : $rewriter($this->_uses, $parents); + $includes = + $this->_includes === null ? null : $rewriter($this->_includes, $parents); + $right_brace = $this->_right_brace === null + ? null + : $rewriter($this->_right_brace, $parents); + if ( + $attribute_spec === $this->_attribute_spec && + $package_keyword === $this->_package_keyword && + $name === $this->_name && + $left_brace === $this->_left_brace && + $uses === $this->_uses && + $includes === $this->_includes && + $right_brace === $this->_right_brace + ) { + return $this; + } + return new static( + $attribute_spec as ?Node, + $package_keyword as ?Node, + $name as ?Node, + $left_brace as ?Node, + $uses as ?Node, + $includes as ?Node, + $right_brace as ?Node, + ); + } + + public function getAttributeSpecUNTYPED(): ?Node { + return $this->_attribute_spec; + } + + public function withAttributeSpec(?Node $value): this { + if ($value === $this->_attribute_spec) { + return $this; + } + return new static( + $value, + $this->_package_keyword, + $this->_name, + $this->_left_brace, + $this->_uses, + $this->_includes, + $this->_right_brace, + ); + } + + public function hasAttributeSpec(): bool { + return $this->_attribute_spec !== null; + } + + /** + * @return unknown + */ + public function getAttributeSpec(): ?Node { + return $this->_attribute_spec; + } + + /** + * @return unknown + */ + public function getAttributeSpecx(): Node { + return TypeAssert\not_null($this->getAttributeSpec()); + } + + public function getPackageKeywordUNTYPED(): ?Node { + return $this->_package_keyword; + } + + public function withPackageKeyword(?Node $value): this { + if ($value === $this->_package_keyword) { + return $this; + } + return new static( + $this->_attribute_spec, + $value, + $this->_name, + $this->_left_brace, + $this->_uses, + $this->_includes, + $this->_right_brace, + ); + } + + public function hasPackageKeyword(): bool { + return $this->_package_keyword !== null; + } + + /** + * @return unknown + */ + public function getPackageKeyword(): ?Node { + return $this->_package_keyword; + } + + /** + * @return unknown + */ + public function getPackageKeywordx(): Node { + return TypeAssert\not_null($this->getPackageKeyword()); + } + + public function getNameUNTYPED(): ?Node { + return $this->_name; + } + + public function withName(?Node $value): this { + if ($value === $this->_name) { + return $this; + } + return new static( + $this->_attribute_spec, + $this->_package_keyword, + $value, + $this->_left_brace, + $this->_uses, + $this->_includes, + $this->_right_brace, + ); + } + + public function hasName(): bool { + return $this->_name !== null; + } + + /** + * @return unknown + */ + public function getName(): ?Node { + return $this->_name; + } + + /** + * @return unknown + */ + public function getNamex(): Node { + return TypeAssert\not_null($this->getName()); + } + + public function getLeftBraceUNTYPED(): ?Node { + return $this->_left_brace; + } + + public function withLeftBrace(?Node $value): this { + if ($value === $this->_left_brace) { + return $this; + } + return new static( + $this->_attribute_spec, + $this->_package_keyword, + $this->_name, + $value, + $this->_uses, + $this->_includes, + $this->_right_brace, + ); + } + + public function hasLeftBrace(): bool { + return $this->_left_brace !== null; + } + + /** + * @return unknown + */ + public function getLeftBrace(): ?Node { + return $this->_left_brace; + } + + /** + * @return unknown + */ + public function getLeftBracex(): Node { + return TypeAssert\not_null($this->getLeftBrace()); + } + + public function getUsesUNTYPED(): ?Node { + return $this->_uses; + } + + public function withUses(?Node $value): this { + if ($value === $this->_uses) { + return $this; + } + return new static( + $this->_attribute_spec, + $this->_package_keyword, + $this->_name, + $this->_left_brace, + $value, + $this->_includes, + $this->_right_brace, + ); + } + + public function hasUses(): bool { + return $this->_uses !== null; + } + + /** + * @return unknown + */ + public function getUses(): ?Node { + return $this->_uses; + } + + /** + * @return unknown + */ + public function getUsesx(): Node { + return TypeAssert\not_null($this->getUses()); + } + + public function getIncludesUNTYPED(): ?Node { + return $this->_includes; + } + + public function withIncludes(?Node $value): this { + if ($value === $this->_includes) { + return $this; + } + return new static( + $this->_attribute_spec, + $this->_package_keyword, + $this->_name, + $this->_left_brace, + $this->_uses, + $value, + $this->_right_brace, + ); + } + + public function hasIncludes(): bool { + return $this->_includes !== null; + } + + /** + * @return unknown + */ + public function getIncludes(): ?Node { + return $this->_includes; + } + + /** + * @return unknown + */ + public function getIncludesx(): Node { + return TypeAssert\not_null($this->getIncludes()); + } + + public function getRightBraceUNTYPED(): ?Node { + return $this->_right_brace; + } + + public function withRightBrace(?Node $value): this { + if ($value === $this->_right_brace) { + return $this; + } + return new static( + $this->_attribute_spec, + $this->_package_keyword, + $this->_name, + $this->_left_brace, + $this->_uses, + $this->_includes, + $value, + ); + } + + public function hasRightBrace(): bool { + return $this->_right_brace !== null; + } + + /** + * @return unknown + */ + public function getRightBrace(): ?Node { + return $this->_right_brace; + } + + /** + * @return unknown + */ + public function getRightBracex(): Node { + return TypeAssert\not_null($this->getRightBrace()); + } +} diff --git a/codegen/syntax/PackageIncludes.hack b/codegen/syntax/PackageIncludes.hack new file mode 100644 index 000000000..300ebef39 --- /dev/null +++ b/codegen/syntax/PackageIncludes.hack @@ -0,0 +1,275 @@ +/** + * This file is generated. Do not modify it manually! + * + * @generated SignedSource<<8ddab217e385115c2ff9dfb4f36fa2fa>> + */ +namespace Facebook\HHAST; +use namespace Facebook\TypeAssert; +use namespace HH\Lib\Dict; +/* HHAST_IGNORE_ALL[5607] 5607 is ignored because of false positives when comparing a generic to a typed value */ +/* HHAST_IGNORE_ALL[5624] HHAST_IGNORE_ALL[5639] 5624 and 5639 are ignored because they insist on using co(tra)variant generics. Could this break external consumers? */ + +<<__ConsistentConstruct>> +final class PackageIncludes extends Node { + + const string SYNTAX_KIND = 'package_includes'; + + private ?Node $_include_keyword; + private ?Node $_left_brace; + private ?Node $_includes; + private ?Node $_right_brace; + + public function __construct( + ?Node $include_keyword, + ?Node $left_brace, + ?Node $includes, + ?Node $right_brace, + ?__Private\SourceRef $source_ref = null, + ) { + $this->_include_keyword = $include_keyword; + $this->_left_brace = $left_brace; + $this->_includes = $includes; + $this->_right_brace = $right_brace; + parent::__construct($source_ref); + } + + <<__Override>> + public static function fromJSON( + dict $json, + string $file, + int $initial_offset, + string $source, + string $_type_hint, + ): this { + $offset = $initial_offset; + $include_keyword = Node::fromJSON( + ($json['package_includes_include_keyword'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $include_keyword?->getWidth() ?? 0; + $left_brace = Node::fromJSON( + ($json['package_includes_left_brace'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $left_brace?->getWidth() ?? 0; + $includes = Node::fromJSON( + ($json['package_includes_includes'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $includes?->getWidth() ?? 0; + $right_brace = Node::fromJSON( + ($json['package_includes_right_brace'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $right_brace?->getWidth() ?? 0; + $source_ref = shape( + 'file' => $file, + 'source' => $source, + 'offset' => $initial_offset, + 'width' => $offset - $initial_offset, + ); + return new static( + /* HH_IGNORE_ERROR[4110] */ $include_keyword, + /* HH_IGNORE_ERROR[4110] */ $left_brace, + /* HH_IGNORE_ERROR[4110] */ $includes, + /* HH_IGNORE_ERROR[4110] */ $right_brace, + $source_ref, + ); + } + + <<__Override>> + public function getChildren(): dict { + return dict[ + 'include_keyword' => $this->_include_keyword, + 'left_brace' => $this->_left_brace, + 'includes' => $this->_includes, + 'right_brace' => $this->_right_brace, + ] + |> Dict\filter_nulls($$); + } + + <<__Override>> + public function rewriteChildren( + (function(Node, vec): Tret) $rewriter, + vec $parents = vec[], + ): this { + $parents[] = $this; + $include_keyword = $this->_include_keyword === null + ? null + : $rewriter($this->_include_keyword, $parents); + $left_brace = $this->_left_brace === null + ? null + : $rewriter($this->_left_brace, $parents); + $includes = + $this->_includes === null ? null : $rewriter($this->_includes, $parents); + $right_brace = $this->_right_brace === null + ? null + : $rewriter($this->_right_brace, $parents); + if ( + $include_keyword === $this->_include_keyword && + $left_brace === $this->_left_brace && + $includes === $this->_includes && + $right_brace === $this->_right_brace + ) { + return $this; + } + return new static( + $include_keyword as ?Node, + $left_brace as ?Node, + $includes as ?Node, + $right_brace as ?Node, + ); + } + + public function getIncludeKeywordUNTYPED(): ?Node { + return $this->_include_keyword; + } + + public function withIncludeKeyword(?Node $value): this { + if ($value === $this->_include_keyword) { + return $this; + } + return new static( + $value, + $this->_left_brace, + $this->_includes, + $this->_right_brace, + ); + } + + public function hasIncludeKeyword(): bool { + return $this->_include_keyword !== null; + } + + /** + * @return unknown + */ + public function getIncludeKeyword(): ?Node { + return $this->_include_keyword; + } + + /** + * @return unknown + */ + public function getIncludeKeywordx(): Node { + return TypeAssert\not_null($this->getIncludeKeyword()); + } + + public function getLeftBraceUNTYPED(): ?Node { + return $this->_left_brace; + } + + public function withLeftBrace(?Node $value): this { + if ($value === $this->_left_brace) { + return $this; + } + return new static( + $this->_include_keyword, + $value, + $this->_includes, + $this->_right_brace, + ); + } + + public function hasLeftBrace(): bool { + return $this->_left_brace !== null; + } + + /** + * @return unknown + */ + public function getLeftBrace(): ?Node { + return $this->_left_brace; + } + + /** + * @return unknown + */ + public function getLeftBracex(): Node { + return TypeAssert\not_null($this->getLeftBrace()); + } + + public function getIncludesUNTYPED(): ?Node { + return $this->_includes; + } + + public function withIncludes(?Node $value): this { + if ($value === $this->_includes) { + return $this; + } + return new static( + $this->_include_keyword, + $this->_left_brace, + $value, + $this->_right_brace, + ); + } + + public function hasIncludes(): bool { + return $this->_includes !== null; + } + + /** + * @return unknown + */ + public function getIncludes(): ?Node { + return $this->_includes; + } + + /** + * @return unknown + */ + public function getIncludesx(): Node { + return TypeAssert\not_null($this->getIncludes()); + } + + public function getRightBraceUNTYPED(): ?Node { + return $this->_right_brace; + } + + public function withRightBrace(?Node $value): this { + if ($value === $this->_right_brace) { + return $this; + } + return new static( + $this->_include_keyword, + $this->_left_brace, + $this->_includes, + $value, + ); + } + + public function hasRightBrace(): bool { + return $this->_right_brace !== null; + } + + /** + * @return unknown + */ + public function getRightBrace(): ?Node { + return $this->_right_brace; + } + + /** + * @return unknown + */ + public function getRightBracex(): Node { + return TypeAssert\not_null($this->getRightBrace()); + } +} diff --git a/codegen/syntax/PackageUses.hack b/codegen/syntax/PackageUses.hack new file mode 100644 index 000000000..e24390edc --- /dev/null +++ b/codegen/syntax/PackageUses.hack @@ -0,0 +1,265 @@ +/** + * This file is generated. Do not modify it manually! + * + * @generated SignedSource<<0fa01f717cb62e81f530c9fdea113c0a>> + */ +namespace Facebook\HHAST; +use namespace Facebook\TypeAssert; +use namespace HH\Lib\Dict; +/* HHAST_IGNORE_ALL[5607] 5607 is ignored because of false positives when comparing a generic to a typed value */ +/* HHAST_IGNORE_ALL[5624] HHAST_IGNORE_ALL[5639] 5624 and 5639 are ignored because they insist on using co(tra)variant generics. Could this break external consumers? */ + +<<__ConsistentConstruct>> +final class PackageUses extends Node { + + const string SYNTAX_KIND = 'package_uses'; + + private ?Node $_use_keyword; + private ?Node $_left_brace; + private ?Node $_uses; + private ?Node $_right_brace; + + public function __construct( + ?Node $use_keyword, + ?Node $left_brace, + ?Node $uses, + ?Node $right_brace, + ?__Private\SourceRef $source_ref = null, + ) { + $this->_use_keyword = $use_keyword; + $this->_left_brace = $left_brace; + $this->_uses = $uses; + $this->_right_brace = $right_brace; + parent::__construct($source_ref); + } + + <<__Override>> + public static function fromJSON( + dict $json, + string $file, + int $initial_offset, + string $source, + string $_type_hint, + ): this { + $offset = $initial_offset; + $use_keyword = Node::fromJSON( + ($json['package_uses_use_keyword'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $use_keyword?->getWidth() ?? 0; + $left_brace = Node::fromJSON( + ($json['package_uses_left_brace'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $left_brace?->getWidth() ?? 0; + $uses = Node::fromJSON( + ($json['package_uses_uses'] ?? dict['kind' => 'missing']) as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $uses?->getWidth() ?? 0; + $right_brace = Node::fromJSON( + ($json['package_uses_right_brace'] ?? dict['kind' => 'missing']) + as dict<_, _>, + $file, + $offset, + $source, + 'Node', + ); + $offset += $right_brace?->getWidth() ?? 0; + $source_ref = shape( + 'file' => $file, + 'source' => $source, + 'offset' => $initial_offset, + 'width' => $offset - $initial_offset, + ); + return new static( + /* HH_IGNORE_ERROR[4110] */ $use_keyword, + /* HH_IGNORE_ERROR[4110] */ $left_brace, + /* HH_IGNORE_ERROR[4110] */ $uses, + /* HH_IGNORE_ERROR[4110] */ $right_brace, + $source_ref, + ); + } + + <<__Override>> + public function getChildren(): dict { + return dict[ + 'use_keyword' => $this->_use_keyword, + 'left_brace' => $this->_left_brace, + 'uses' => $this->_uses, + 'right_brace' => $this->_right_brace, + ] + |> Dict\filter_nulls($$); + } + + <<__Override>> + public function rewriteChildren( + (function(Node, vec): Tret) $rewriter, + vec $parents = vec[], + ): this { + $parents[] = $this; + $use_keyword = $this->_use_keyword === null + ? null + : $rewriter($this->_use_keyword, $parents); + $left_brace = $this->_left_brace === null + ? null + : $rewriter($this->_left_brace, $parents); + $uses = $this->_uses === null ? null : $rewriter($this->_uses, $parents); + $right_brace = $this->_right_brace === null + ? null + : $rewriter($this->_right_brace, $parents); + if ( + $use_keyword === $this->_use_keyword && + $left_brace === $this->_left_brace && + $uses === $this->_uses && + $right_brace === $this->_right_brace + ) { + return $this; + } + return new static( + $use_keyword as ?Node, + $left_brace as ?Node, + $uses as ?Node, + $right_brace as ?Node, + ); + } + + public function getUseKeywordUNTYPED(): ?Node { + return $this->_use_keyword; + } + + public function withUseKeyword(?Node $value): this { + if ($value === $this->_use_keyword) { + return $this; + } + return + new static($value, $this->_left_brace, $this->_uses, $this->_right_brace); + } + + public function hasUseKeyword(): bool { + return $this->_use_keyword !== null; + } + + /** + * @return unknown + */ + public function getUseKeyword(): ?Node { + return $this->_use_keyword; + } + + /** + * @return unknown + */ + public function getUseKeywordx(): Node { + return TypeAssert\not_null($this->getUseKeyword()); + } + + public function getLeftBraceUNTYPED(): ?Node { + return $this->_left_brace; + } + + public function withLeftBrace(?Node $value): this { + if ($value === $this->_left_brace) { + return $this; + } + return new static( + $this->_use_keyword, + $value, + $this->_uses, + $this->_right_brace, + ); + } + + public function hasLeftBrace(): bool { + return $this->_left_brace !== null; + } + + /** + * @return unknown + */ + public function getLeftBrace(): ?Node { + return $this->_left_brace; + } + + /** + * @return unknown + */ + public function getLeftBracex(): Node { + return TypeAssert\not_null($this->getLeftBrace()); + } + + public function getUsesUNTYPED(): ?Node { + return $this->_uses; + } + + public function withUses(?Node $value): this { + if ($value === $this->_uses) { + return $this; + } + return new static( + $this->_use_keyword, + $this->_left_brace, + $value, + $this->_right_brace, + ); + } + + public function hasUses(): bool { + return $this->_uses !== null; + } + + /** + * @return unknown + */ + public function getUses(): ?Node { + return $this->_uses; + } + + /** + * @return unknown + */ + public function getUsesx(): Node { + return TypeAssert\not_null($this->getUses()); + } + + public function getRightBraceUNTYPED(): ?Node { + return $this->_right_brace; + } + + public function withRightBrace(?Node $value): this { + if ($value === $this->_right_brace) { + return $this; + } + return + new static($this->_use_keyword, $this->_left_brace, $this->_uses, $value); + } + + public function hasRightBrace(): bool { + return $this->_right_brace !== null; + } + + /** + * @return unknown + */ + public function getRightBrace(): ?Node { + return $this->_right_brace; + } + + /** + * @return unknown + */ + public function getRightBracex(): Node { + return TypeAssert\not_null($this->getRightBrace()); + } +} diff --git a/codegen/syntax/ParameterDeclaration.hack b/codegen/syntax/ParameterDeclaration.hack index d5fde3ed1..ef5e01c20 100644 --- a/codegen/syntax/ParameterDeclaration.hack +++ b/codegen/syntax/ParameterDeclaration.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<1a479503fe3a347962036a518871ea84>> + * @generated SignedSource<<4a583b05a02a5a15994cf04124f6b5ce>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -22,7 +22,7 @@ final class ParameterDeclaration private ?Token $_visibility; private ?InoutToken $_call_convention; private ?ReadonlyToken $_readonly; - private ?ITypeSpecifier $_type; + private ?Node $_type; private IExpression $_name; private ?SimpleInitializer $_default_value; @@ -31,7 +31,7 @@ final class ParameterDeclaration ?Token $visibility, ?InoutToken $call_convention, ?ReadonlyToken $readonly, - ?ITypeSpecifier $type, + ?Node $type, IExpression $name, ?SimpleInitializer $default_value, ?__Private\SourceRef $source_ref = null, @@ -94,7 +94,7 @@ final class ParameterDeclaration $file, $offset, $source, - 'ITypeSpecifier', + 'Node', ); $offset += $type?->getWidth() ?? 0; $name = Node::fromJSON( @@ -185,7 +185,7 @@ final class ParameterDeclaration $visibility as ?Token, $call_convention as ?InoutToken, $readonly as ?ReadonlyToken, - $type as ?ITypeSpecifier, + $type as ?Node, $name as IExpression, $default_value as ?SimpleInitializer, ); @@ -347,7 +347,7 @@ final class ParameterDeclaration return $this->_type; } - public function withType(?ITypeSpecifier $value): this { + public function withType(?Node $value): this { if ($value === $this->_type) { return $this; } @@ -371,9 +371,9 @@ final class ParameterDeclaration * DarrayTypeSpecifier | DictionaryTypeSpecifier | GenericTypeSpecifier | * KeysetTypeSpecifier | LikeTypeSpecifier | null | NullableTypeSpecifier | * ShapeTypeSpecifier | SimpleTypeSpecifier | TupleTypeSpecifier | - * TypeConstant | VarrayTypeSpecifier | VectorTypeSpecifier + * TypeConstant | TypeRefinement | VarrayTypeSpecifier | VectorTypeSpecifier */ - public function getType(): ?ITypeSpecifier { + public function getType(): ?Node { return $this->_type; } @@ -382,9 +382,9 @@ final class ParameterDeclaration * DarrayTypeSpecifier | DictionaryTypeSpecifier | GenericTypeSpecifier | * KeysetTypeSpecifier | LikeTypeSpecifier | NullableTypeSpecifier | * ShapeTypeSpecifier | SimpleTypeSpecifier | TupleTypeSpecifier | - * TypeConstant | VarrayTypeSpecifier | VectorTypeSpecifier + * TypeConstant | TypeRefinement | VarrayTypeSpecifier | VectorTypeSpecifier */ - public function getTypex(): ITypeSpecifier { + public function getTypex(): Node { return TypeAssert\not_null($this->getType()); } diff --git a/codegen/syntax/PropertyDeclaration.hack b/codegen/syntax/PropertyDeclaration.hack index 75c1bb1c2..f968672ac 100644 --- a/codegen/syntax/PropertyDeclaration.hack +++ b/codegen/syntax/PropertyDeclaration.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -207,16 +207,16 @@ final class PropertyDeclaration } /** - * @return NodeList | NodeList | NodeList - * | NodeList | NodeList | NodeList + * @return NodeList | NodeList | + * NodeList | NodeList | NodeList */ public function getModifiers(): NodeList { return TypeAssert\instance_of(NodeList::class, $this->_modifiers); } /** - * @return NodeList | NodeList | NodeList - * | NodeList | NodeList | NodeList + * @return NodeList | NodeList | + * NodeList | NodeList | NodeList */ public function getModifiersx(): NodeList { return $this->getModifiers(); diff --git a/codegen/syntax/RequireClause.hack b/codegen/syntax/RequireClause.hack index 985e374c6..854d80ae7 100644 --- a/codegen/syntax/RequireClause.hack +++ b/codegen/syntax/RequireClause.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<826a6631b25eebc933ad97717e787801>> + * @generated SignedSource<<1942cefd059c3c71fffb9e761ebf16ca>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -175,14 +175,14 @@ final class RequireClause extends Node implements IClassBodyDeclaration { } /** - * @return ExtendsToken | ImplementsToken + * @return ClassToken | ExtendsToken | ImplementsToken */ public function getKind(): Token { return TypeAssert\instance_of(Token::class, $this->_kind); } /** - * @return ExtendsToken | ImplementsToken + * @return ClassToken | ExtendsToken | ImplementsToken */ public function getKindx(): Token { return $this->getKind(); diff --git a/codegen/syntax/SoftTypeSpecifier.hack b/codegen/syntax/SoftTypeSpecifier.hack index edeb8bcd9..58ab1a67d 100644 --- a/codegen/syntax/SoftTypeSpecifier.hack +++ b/codegen/syntax/SoftTypeSpecifier.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<071b43505cbdd21bf28bfe78510c618e>> + * @generated SignedSource<<99833ac638a55613e95bd4a97b1f8c5b>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -14,12 +14,12 @@ final class SoftTypeSpecifier extends Node implements ITypeSpecifier { const string SYNTAX_KIND = 'soft_type_specifier'; - private ?Node $_at; - private ?Node $_type; + private AtToken $_at; + private ITypeSpecifier $_type; public function __construct( - ?Node $at, - ?Node $type, + AtToken $at, + ITypeSpecifier $type, ?__Private\SourceRef $source_ref = null, ) { $this->_at = $at; @@ -37,21 +37,23 @@ final class SoftTypeSpecifier extends Node implements ITypeSpecifier { ): this { $offset = $initial_offset; $at = Node::fromJSON( - ($json['soft_at'] ?? dict['kind' => 'missing']) as dict<_, _>, + ($json['soft_at']) as dict<_, _>, $file, $offset, $source, - 'Node', + 'AtToken', ); - $offset += $at?->getWidth() ?? 0; + $at = $at as nonnull; + $offset += $at->getWidth(); $type = Node::fromJSON( - ($json['soft_type'] ?? dict['kind' => 'missing']) as dict<_, _>, + ($json['soft_type']) as dict<_, _>, $file, $offset, $source, - 'Node', + 'ITypeSpecifier', ); - $offset += $type?->getWidth() ?? 0; + $type = $type as nonnull; + $offset += $type->getWidth(); $source_ref = shape( 'file' => $file, 'source' => $source, @@ -80,19 +82,19 @@ final class SoftTypeSpecifier extends Node implements ITypeSpecifier { vec $parents = vec[], ): this { $parents[] = $this; - $at = $this->_at === null ? null : $rewriter($this->_at, $parents); - $type = $this->_type === null ? null : $rewriter($this->_type, $parents); + $at = $rewriter($this->_at, $parents); + $type = $rewriter($this->_type, $parents); if ($at === $this->_at && $type === $this->_type) { return $this; } - return new static($at as ?Node, $type as ?Node); + return new static($at as AtToken, $type as ITypeSpecifier); } public function getAtUNTYPED(): ?Node { return $this->_at; } - public function withAt(?Node $value): this { + public function withAt(AtToken $value): this { if ($value === $this->_at) { return $this; } @@ -100,28 +102,28 @@ final class SoftTypeSpecifier extends Node implements ITypeSpecifier { } public function hasAt(): bool { - return $this->_at !== null; + return true; } /** - * @return unknown + * @return AtToken */ - public function getAt(): ?Node { - return $this->_at; + public function getAt(): AtToken { + return TypeAssert\instance_of(AtToken::class, $this->_at); } /** - * @return unknown + * @return AtToken */ - public function getAtx(): Node { - return TypeAssert\not_null($this->getAt()); + public function getAtx(): AtToken { + return $this->getAt(); } public function getTypeUNTYPED(): ?Node { return $this->_type; } - public function withType(?Node $value): this { + public function withType(ITypeSpecifier $value): this { if ($value === $this->_type) { return $this; } @@ -129,20 +131,20 @@ final class SoftTypeSpecifier extends Node implements ITypeSpecifier { } public function hasType(): bool { - return $this->_type !== null; + return true; } /** - * @return unknown + * @return LikeTypeSpecifier | SimpleTypeSpecifier */ - public function getType(): ?Node { - return $this->_type; + public function getType(): ITypeSpecifier { + return TypeAssert\instance_of(ITypeSpecifier::class, $this->_type); } /** - * @return unknown + * @return LikeTypeSpecifier | SimpleTypeSpecifier */ - public function getTypex(): Node { - return TypeAssert\not_null($this->getType()); + public function getTypex(): ITypeSpecifier { + return $this->getType(); } } diff --git a/codegen/syntax/TypeArguments.hack b/codegen/syntax/TypeArguments.hack index e32ee6808..e0ee01cb5 100644 --- a/codegen/syntax/TypeArguments.hack +++ b/codegen/syntax/TypeArguments.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<8da116ce9939abde432f646389ec149e>> + * @generated SignedSource<> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -15,12 +15,12 @@ final class TypeArguments extends Node { const string SYNTAX_KIND = 'type_arguments'; private LessThanToken $_left_angle; - private ?NodeList> $_types; + private ?NodeList> $_types; private GreaterThanToken $_right_angle; public function __construct( LessThanToken $left_angle, - ?NodeList> $types, + ?NodeList> $types, GreaterThanToken $right_angle, ?__Private\SourceRef $source_ref = null, ) { @@ -54,7 +54,7 @@ final class TypeArguments extends Node { $file, $offset, $source, - 'NodeList>', + 'NodeList>', ); $offset += $types?->getWidth() ?? 0; $right_angle = Node::fromJSON( @@ -108,7 +108,7 @@ final class TypeArguments extends Node { } return new static( $left_angle as LessThanToken, - /* HH_FIXME[4110] ?NodeList> may not be enforceable */ $types, + /* HH_FIXME[4110] ?NodeList> may not be enforceable */ $types, $right_angle as GreaterThanToken, ); } @@ -146,7 +146,7 @@ final class TypeArguments extends Node { return $this->_types; } - public function withTypes(?NodeList> $value): this { + public function withTypes(?NodeList> $value): this { if ($value === $this->_types) { return $this; } @@ -170,12 +170,13 @@ final class TypeArguments extends Node { * NodeList> | * NodeList> | * NodeList> | - * NodeList> | + * NodeList> | NodeList> | * NodeList> | NodeList> - * | NodeList> | + * | NodeList> | + * NodeList> | * NodeList> | null */ - public function getTypes(): ?NodeList> { + public function getTypes(): ?NodeList> { return $this->_types; } @@ -192,12 +193,13 @@ final class TypeArguments extends Node { * NodeList> | * NodeList> | * NodeList> | - * NodeList> | + * NodeList> | NodeList> | * NodeList> | NodeList> - * | NodeList> | + * | NodeList> | + * NodeList> | * NodeList> */ - public function getTypesx(): NodeList> { + public function getTypesx(): NodeList> { return TypeAssert\not_null($this->getTypes()); } diff --git a/codegen/syntax/TypeConstraint.hack b/codegen/syntax/TypeConstraint.hack index ee8beb2c4..564ebd591 100644 --- a/codegen/syntax/TypeConstraint.hack +++ b/codegen/syntax/TypeConstraint.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<8e3130923200461713699d8467cb78a0>> + * @generated SignedSource<> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -15,11 +15,11 @@ final class TypeConstraint extends Node { const string SYNTAX_KIND = 'type_constraint'; private Token $_keyword; - private ITypeSpecifier $_type; + private Node $_type; public function __construct( Token $keyword, - ITypeSpecifier $type, + Node $type, ?__Private\SourceRef $source_ref = null, ) { $this->_keyword = $keyword; @@ -50,7 +50,7 @@ final class TypeConstraint extends Node { $file, $offset, $source, - 'ITypeSpecifier', + 'Node', ); $type = $type as nonnull; $offset += $type->getWidth(); @@ -87,7 +87,7 @@ final class TypeConstraint extends Node { if ($keyword === $this->_keyword && $type === $this->_type) { return $this; } - return new static($keyword as Token, $type as ITypeSpecifier); + return new static($keyword as Token, $type as Node); } public function getKeywordUNTYPED(): ?Node { @@ -123,7 +123,7 @@ final class TypeConstraint extends Node { return $this->_type; } - public function withType(ITypeSpecifier $value): this { + public function withType(Node $value): this { if ($value === $this->_type) { return $this; } @@ -137,20 +137,20 @@ final class TypeConstraint extends Node { /** * @return ClassnameTypeSpecifier | ClosureTypeSpecifier | * GenericTypeSpecifier | LikeTypeSpecifier | NullableTypeSpecifier | - * ShapeTypeSpecifier | SimpleTypeSpecifier | TypeConstant | + * ShapeTypeSpecifier | SimpleTypeSpecifier | TypeConstant | TypeRefinement | * VarrayTypeSpecifier | VectorTypeSpecifier */ - public function getType(): ITypeSpecifier { - return TypeAssert\instance_of(ITypeSpecifier::class, $this->_type); + public function getType(): Node { + return $this->_type; } /** * @return ClassnameTypeSpecifier | ClosureTypeSpecifier | * GenericTypeSpecifier | LikeTypeSpecifier | NullableTypeSpecifier | - * ShapeTypeSpecifier | SimpleTypeSpecifier | TypeConstant | + * ShapeTypeSpecifier | SimpleTypeSpecifier | TypeConstant | TypeRefinement | * VarrayTypeSpecifier | VectorTypeSpecifier */ - public function getTypex(): ITypeSpecifier { + public function getTypex(): Node { return $this->getType(); } } diff --git a/codegen/syntax/TypeInRefinement.hack b/codegen/syntax/TypeInRefinement.hack index ee46e6ea1..5c289a44f 100644 --- a/codegen/syntax/TypeInRefinement.hack +++ b/codegen/syntax/TypeInRefinement.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<> + * @generated SignedSource<> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -14,20 +14,20 @@ final class TypeInRefinement extends Node { const string SYNTAX_KIND = 'type_in_refinement'; - private ?Node $_keyword; - private ?Node $_name; + private TypeToken $_keyword; + private NameToken $_name; private ?Node $_type_parameters; private ?Node $_constraints; - private ?Node $_equal; - private ?Node $_type; + private EqualToken $_equal; + private ITypeSpecifier $_type; public function __construct( - ?Node $keyword, - ?Node $name, + TypeToken $keyword, + NameToken $name, ?Node $type_parameters, ?Node $constraints, - ?Node $equal, - ?Node $type, + EqualToken $equal, + ITypeSpecifier $type, ?__Private\SourceRef $source_ref = null, ) { $this->_keyword = $keyword; @@ -49,23 +49,23 @@ final class TypeInRefinement extends Node { ): this { $offset = $initial_offset; $keyword = Node::fromJSON( - ($json['type_in_refinement_keyword'] ?? dict['kind' => 'missing']) - as dict<_, _>, + ($json['type_in_refinement_keyword']) as dict<_, _>, $file, $offset, $source, - 'Node', + 'TypeToken', ); - $offset += $keyword?->getWidth() ?? 0; + $keyword = $keyword as nonnull; + $offset += $keyword->getWidth(); $name = Node::fromJSON( - ($json['type_in_refinement_name'] ?? dict['kind' => 'missing']) - as dict<_, _>, + ($json['type_in_refinement_name']) as dict<_, _>, $file, $offset, $source, - 'Node', + 'NameToken', ); - $offset += $name?->getWidth() ?? 0; + $name = $name as nonnull; + $offset += $name->getWidth(); $type_parameters = Node::fromJSON( ($json['type_in_refinement_type_parameters'] ?? dict['kind' => 'missing']) as dict<_, _>, @@ -85,23 +85,23 @@ final class TypeInRefinement extends Node { ); $offset += $constraints?->getWidth() ?? 0; $equal = Node::fromJSON( - ($json['type_in_refinement_equal'] ?? dict['kind' => 'missing']) - as dict<_, _>, + ($json['type_in_refinement_equal']) as dict<_, _>, $file, $offset, $source, - 'Node', + 'EqualToken', ); - $offset += $equal?->getWidth() ?? 0; + $equal = $equal as nonnull; + $offset += $equal->getWidth(); $type = Node::fromJSON( - ($json['type_in_refinement_type'] ?? dict['kind' => 'missing']) - as dict<_, _>, + ($json['type_in_refinement_type']) as dict<_, _>, $file, $offset, $source, - 'Node', + 'ITypeSpecifier', ); - $offset += $type?->getWidth() ?? 0; + $type = $type as nonnull; + $offset += $type->getWidth(); $source_ref = shape( 'file' => $file, 'source' => $source, @@ -138,17 +138,16 @@ final class TypeInRefinement extends Node { vec $parents = vec[], ): this { $parents[] = $this; - $keyword = - $this->_keyword === null ? null : $rewriter($this->_keyword, $parents); - $name = $this->_name === null ? null : $rewriter($this->_name, $parents); + $keyword = $rewriter($this->_keyword, $parents); + $name = $rewriter($this->_name, $parents); $type_parameters = $this->_type_parameters === null ? null : $rewriter($this->_type_parameters, $parents); $constraints = $this->_constraints === null ? null : $rewriter($this->_constraints, $parents); - $equal = $this->_equal === null ? null : $rewriter($this->_equal, $parents); - $type = $this->_type === null ? null : $rewriter($this->_type, $parents); + $equal = $rewriter($this->_equal, $parents); + $type = $rewriter($this->_type, $parents); if ( $keyword === $this->_keyword && $name === $this->_name && @@ -160,12 +159,12 @@ final class TypeInRefinement extends Node { return $this; } return new static( - $keyword as ?Node, - $name as ?Node, + $keyword as TypeToken, + $name as NameToken, $type_parameters as ?Node, $constraints as ?Node, - $equal as ?Node, - $type as ?Node, + $equal as EqualToken, + $type as ITypeSpecifier, ); } @@ -173,7 +172,7 @@ final class TypeInRefinement extends Node { return $this->_keyword; } - public function withKeyword(?Node $value): this { + public function withKeyword(TypeToken $value): this { if ($value === $this->_keyword) { return $this; } @@ -188,28 +187,28 @@ final class TypeInRefinement extends Node { } public function hasKeyword(): bool { - return $this->_keyword !== null; + return true; } /** - * @return unknown + * @return TypeToken */ - public function getKeyword(): ?Node { - return $this->_keyword; + public function getKeyword(): TypeToken { + return TypeAssert\instance_of(TypeToken::class, $this->_keyword); } /** - * @return unknown + * @return TypeToken */ - public function getKeywordx(): Node { - return TypeAssert\not_null($this->getKeyword()); + public function getKeywordx(): TypeToken { + return $this->getKeyword(); } public function getNameUNTYPED(): ?Node { return $this->_name; } - public function withName(?Node $value): this { + public function withName(NameToken $value): this { if ($value === $this->_name) { return $this; } @@ -224,21 +223,21 @@ final class TypeInRefinement extends Node { } public function hasName(): bool { - return $this->_name !== null; + return true; } /** - * @return unknown + * @return NameToken */ - public function getName(): ?Node { - return $this->_name; + public function getName(): NameToken { + return TypeAssert\instance_of(NameToken::class, $this->_name); } /** - * @return unknown + * @return NameToken */ - public function getNamex(): Node { - return TypeAssert\not_null($this->getName()); + public function getNamex(): NameToken { + return $this->getName(); } public function getTypeParametersUNTYPED(): ?Node { @@ -264,14 +263,14 @@ final class TypeInRefinement extends Node { } /** - * @return unknown + * @return null */ public function getTypeParameters(): ?Node { return $this->_type_parameters; } /** - * @return unknown + * @return */ public function getTypeParametersx(): Node { return TypeAssert\not_null($this->getTypeParameters()); @@ -300,14 +299,14 @@ final class TypeInRefinement extends Node { } /** - * @return unknown + * @return null */ public function getConstraints(): ?Node { return $this->_constraints; } /** - * @return unknown + * @return */ public function getConstraintsx(): Node { return TypeAssert\not_null($this->getConstraints()); @@ -317,7 +316,7 @@ final class TypeInRefinement extends Node { return $this->_equal; } - public function withEqual(?Node $value): this { + public function withEqual(EqualToken $value): this { if ($value === $this->_equal) { return $this; } @@ -332,28 +331,28 @@ final class TypeInRefinement extends Node { } public function hasEqual(): bool { - return $this->_equal !== null; + return true; } /** - * @return unknown + * @return EqualToken */ - public function getEqual(): ?Node { - return $this->_equal; + public function getEqual(): EqualToken { + return TypeAssert\instance_of(EqualToken::class, $this->_equal); } /** - * @return unknown + * @return EqualToken */ - public function getEqualx(): Node { - return TypeAssert\not_null($this->getEqual()); + public function getEqualx(): EqualToken { + return $this->getEqual(); } public function getTypeUNTYPED(): ?Node { return $this->_type; } - public function withType(?Node $value): this { + public function withType(ITypeSpecifier $value): this { if ($value === $this->_type) { return $this; } @@ -368,20 +367,20 @@ final class TypeInRefinement extends Node { } public function hasType(): bool { - return $this->_type !== null; + return true; } /** - * @return unknown + * @return SimpleTypeSpecifier | TypeConstant */ - public function getType(): ?Node { - return $this->_type; + public function getType(): ITypeSpecifier { + return TypeAssert\instance_of(ITypeSpecifier::class, $this->_type); } /** - * @return unknown + * @return SimpleTypeSpecifier | TypeConstant */ - public function getTypex(): Node { - return TypeAssert\not_null($this->getType()); + public function getTypex(): ITypeSpecifier { + return $this->getType(); } } diff --git a/codegen/syntax/TypeRefinement.hack b/codegen/syntax/TypeRefinement.hack index 7696e6fc0..7520013e2 100644 --- a/codegen/syntax/TypeRefinement.hack +++ b/codegen/syntax/TypeRefinement.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<0e1a92dc39647bc3121831fdcc626aca>> + * @generated SignedSource<> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -14,18 +14,18 @@ final class TypeRefinement extends Node { const string SYNTAX_KIND = 'type_refinement'; - private ?Node $_type; - private ?Node $_keyword; - private ?Node $_left_brace; - private ?Node $_members; - private ?Node $_right_brace; + private SimpleTypeSpecifier $_type; + private WithToken $_keyword; + private LeftBraceToken $_left_brace; + private NodeList> $_members; + private RightBraceToken $_right_brace; public function __construct( - ?Node $type, - ?Node $keyword, - ?Node $left_brace, - ?Node $members, - ?Node $right_brace, + SimpleTypeSpecifier $type, + WithToken $keyword, + LeftBraceToken $left_brace, + NodeList> $members, + RightBraceToken $right_brace, ?__Private\SourceRef $source_ref = null, ) { $this->_type = $type; @@ -46,50 +46,50 @@ final class TypeRefinement extends Node { ): this { $offset = $initial_offset; $type = Node::fromJSON( - ($json['type_refinement_type'] ?? dict['kind' => 'missing']) - as dict<_, _>, + ($json['type_refinement_type']) as dict<_, _>, $file, $offset, $source, - 'Node', + 'SimpleTypeSpecifier', ); - $offset += $type?->getWidth() ?? 0; + $type = $type as nonnull; + $offset += $type->getWidth(); $keyword = Node::fromJSON( - ($json['type_refinement_keyword'] ?? dict['kind' => 'missing']) - as dict<_, _>, + ($json['type_refinement_keyword']) as dict<_, _>, $file, $offset, $source, - 'Node', + 'WithToken', ); - $offset += $keyword?->getWidth() ?? 0; + $keyword = $keyword as nonnull; + $offset += $keyword->getWidth(); $left_brace = Node::fromJSON( - ($json['type_refinement_left_brace'] ?? dict['kind' => 'missing']) - as dict<_, _>, + ($json['type_refinement_left_brace']) as dict<_, _>, $file, $offset, $source, - 'Node', + 'LeftBraceToken', ); - $offset += $left_brace?->getWidth() ?? 0; + $left_brace = $left_brace as nonnull; + $offset += $left_brace->getWidth(); $members = Node::fromJSON( - ($json['type_refinement_members'] ?? dict['kind' => 'missing']) - as dict<_, _>, + ($json['type_refinement_members']) as dict<_, _>, $file, $offset, $source, - 'Node', + 'NodeList>', ); - $offset += $members?->getWidth() ?? 0; + $members = $members as nonnull; + $offset += $members->getWidth(); $right_brace = Node::fromJSON( - ($json['type_refinement_right_brace'] ?? dict['kind' => 'missing']) - as dict<_, _>, + ($json['type_refinement_right_brace']) as dict<_, _>, $file, $offset, $source, - 'Node', + 'RightBraceToken', ); - $offset += $right_brace?->getWidth() ?? 0; + $right_brace = $right_brace as nonnull; + $offset += $right_brace->getWidth(); $source_ref = shape( 'file' => $file, 'source' => $source, @@ -124,17 +124,11 @@ final class TypeRefinement extends Node { vec $parents = vec[], ): this { $parents[] = $this; - $type = $this->_type === null ? null : $rewriter($this->_type, $parents); - $keyword = - $this->_keyword === null ? null : $rewriter($this->_keyword, $parents); - $left_brace = $this->_left_brace === null - ? null - : $rewriter($this->_left_brace, $parents); - $members = - $this->_members === null ? null : $rewriter($this->_members, $parents); - $right_brace = $this->_right_brace === null - ? null - : $rewriter($this->_right_brace, $parents); + $type = $rewriter($this->_type, $parents); + $keyword = $rewriter($this->_keyword, $parents); + $left_brace = $rewriter($this->_left_brace, $parents); + $members = $rewriter($this->_members, $parents); + $right_brace = $rewriter($this->_right_brace, $parents); if ( $type === $this->_type && $keyword === $this->_keyword && @@ -145,11 +139,11 @@ final class TypeRefinement extends Node { return $this; } return new static( - $type as ?Node, - $keyword as ?Node, - $left_brace as ?Node, - $members as ?Node, - $right_brace as ?Node, + $type as SimpleTypeSpecifier, + $keyword as WithToken, + $left_brace as LeftBraceToken, + /* HH_FIXME[4110] NodeList> may not be enforceable */ $members, + $right_brace as RightBraceToken, ); } @@ -157,7 +151,7 @@ final class TypeRefinement extends Node { return $this->_type; } - public function withType(?Node $value): this { + public function withType(SimpleTypeSpecifier $value): this { if ($value === $this->_type) { return $this; } @@ -171,28 +165,28 @@ final class TypeRefinement extends Node { } public function hasType(): bool { - return $this->_type !== null; + return true; } /** - * @return unknown + * @return SimpleTypeSpecifier */ - public function getType(): ?Node { - return $this->_type; + public function getType(): SimpleTypeSpecifier { + return TypeAssert\instance_of(SimpleTypeSpecifier::class, $this->_type); } /** - * @return unknown + * @return SimpleTypeSpecifier */ - public function getTypex(): Node { - return TypeAssert\not_null($this->getType()); + public function getTypex(): SimpleTypeSpecifier { + return $this->getType(); } public function getKeywordUNTYPED(): ?Node { return $this->_keyword; } - public function withKeyword(?Node $value): this { + public function withKeyword(WithToken $value): this { if ($value === $this->_keyword) { return $this; } @@ -206,28 +200,28 @@ final class TypeRefinement extends Node { } public function hasKeyword(): bool { - return $this->_keyword !== null; + return true; } /** - * @return unknown + * @return WithToken */ - public function getKeyword(): ?Node { - return $this->_keyword; + public function getKeyword(): WithToken { + return TypeAssert\instance_of(WithToken::class, $this->_keyword); } /** - * @return unknown + * @return WithToken */ - public function getKeywordx(): Node { - return TypeAssert\not_null($this->getKeyword()); + public function getKeywordx(): WithToken { + return $this->getKeyword(); } public function getLeftBraceUNTYPED(): ?Node { return $this->_left_brace; } - public function withLeftBrace(?Node $value): this { + public function withLeftBrace(LeftBraceToken $value): this { if ($value === $this->_left_brace) { return $this; } @@ -241,28 +235,30 @@ final class TypeRefinement extends Node { } public function hasLeftBrace(): bool { - return $this->_left_brace !== null; + return true; } /** - * @return unknown + * @return LeftBraceToken */ - public function getLeftBrace(): ?Node { - return $this->_left_brace; + public function getLeftBrace(): LeftBraceToken { + return TypeAssert\instance_of(LeftBraceToken::class, $this->_left_brace); } /** - * @return unknown + * @return LeftBraceToken */ - public function getLeftBracex(): Node { - return TypeAssert\not_null($this->getLeftBrace()); + public function getLeftBracex(): LeftBraceToken { + return $this->getLeftBrace(); } public function getMembersUNTYPED(): ?Node { return $this->_members; } - public function withMembers(?Node $value): this { + public function withMembers( + NodeList> $value, + ): this { if ($value === $this->_members) { return $this; } @@ -276,28 +272,28 @@ final class TypeRefinement extends Node { } public function hasMembers(): bool { - return $this->_members !== null; + return true; } /** - * @return unknown + * @return NodeList> */ - public function getMembers(): ?Node { - return $this->_members; + public function getMembers(): NodeList> { + return TypeAssert\instance_of(NodeList::class, $this->_members); } /** - * @return unknown + * @return NodeList> */ - public function getMembersx(): Node { - return TypeAssert\not_null($this->getMembers()); + public function getMembersx(): NodeList> { + return $this->getMembers(); } public function getRightBraceUNTYPED(): ?Node { return $this->_right_brace; } - public function withRightBrace(?Node $value): this { + public function withRightBrace(RightBraceToken $value): this { if ($value === $this->_right_brace) { return $this; } @@ -311,20 +307,20 @@ final class TypeRefinement extends Node { } public function hasRightBrace(): bool { - return $this->_right_brace !== null; + return true; } /** - * @return unknown + * @return RightBraceToken */ - public function getRightBrace(): ?Node { - return $this->_right_brace; + public function getRightBrace(): RightBraceToken { + return TypeAssert\instance_of(RightBraceToken::class, $this->_right_brace); } /** - * @return unknown + * @return RightBraceToken */ - public function getRightBracex(): Node { - return TypeAssert\not_null($this->getRightBrace()); + public function getRightBracex(): RightBraceToken { + return $this->getRightBrace(); } } diff --git a/codegen/syntax/WhereConstraint.hack b/codegen/syntax/WhereConstraint.hack index bca670f70..e47199ea8 100644 --- a/codegen/syntax/WhereConstraint.hack +++ b/codegen/syntax/WhereConstraint.hack @@ -1,7 +1,7 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<82c89e9b354650c7f73cd2b9746122d3>> + * @generated SignedSource<<79d420983bf86f9cea4c99090d98855e>> */ namespace Facebook\HHAST; use namespace Facebook\TypeAssert; @@ -16,12 +16,12 @@ final class WhereConstraint extends Node { private ITypeSpecifier $_left_type; private Token $_operator; - private ITypeSpecifier $_right_type; + private Node $_right_type; public function __construct( ITypeSpecifier $left_type, Token $operator, - ITypeSpecifier $right_type, + Node $right_type, ?__Private\SourceRef $source_ref = null, ) { $this->_left_type = $left_type; @@ -62,7 +62,7 @@ final class WhereConstraint extends Node { $file, $offset, $source, - 'ITypeSpecifier', + 'Node', ); $right_type = $right_type as nonnull; $offset += $right_type->getWidth(); @@ -109,7 +109,7 @@ final class WhereConstraint extends Node { return new static( $left_type as ITypeSpecifier, $operator as Token, - $right_type as ITypeSpecifier, + $right_type as Node, ); } @@ -177,7 +177,7 @@ final class WhereConstraint extends Node { return $this->_right_type; } - public function withRightType(ITypeSpecifier $value): this { + public function withRightType(Node $value): this { if ($value === $this->_right_type) { return $this; } @@ -191,18 +191,18 @@ final class WhereConstraint extends Node { /** * @return DictionaryTypeSpecifier | GenericTypeSpecifier | * NullableTypeSpecifier | SimpleTypeSpecifier | TypeConstant | - * VectorTypeSpecifier + * TypeRefinement | VectorTypeSpecifier */ - public function getRightType(): ITypeSpecifier { - return TypeAssert\instance_of(ITypeSpecifier::class, $this->_right_type); + public function getRightType(): Node { + return $this->_right_type; } /** * @return DictionaryTypeSpecifier | GenericTypeSpecifier | * NullableTypeSpecifier | SimpleTypeSpecifier | TypeConstant | - * VectorTypeSpecifier + * TypeRefinement | VectorTypeSpecifier */ - public function getRightTypex(): ITypeSpecifier { + public function getRightTypex(): Node { return $this->getRightType(); } } diff --git a/codegen/token_from_data.hack b/codegen/token_from_data.hack index d680e61c7..599b21db1 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<<4978deeca1ca80509cdf59832edc22ab>> + * @generated SignedSource<<7d078c309d4c59beeb06f60355a04722>> */ namespace Facebook\HHAST\__Private; use namespace Facebook\HHAST; @@ -55,20 +55,16 @@ final class TokenClassMap { 'ctx' => HHAST\CtxToken::class, 'darray' => HHAST\DarrayToken::class, 'default' => HHAST\DefaultToken::class, - 'define' => HHAST\DefineToken::class, 'dict' => HHAST\DictToken::class, 'do' => HHAST\DoToken::class, 'double' => HHAST\DoubleToken::class, 'echo' => HHAST\EchoToken::class, 'else' => HHAST\ElseToken::class, 'empty' => HHAST\EmptyToken::class, - 'endfor' => HHAST\EndforToken::class, - 'endforeach' => HHAST\EndforeachToken::class, 'endif' => HHAST\EndifToken::class, - 'endswitch' => HHAST\EndswitchToken::class, - 'endwhile' => HHAST\EndwhileToken::class, 'enum' => HHAST\EnumToken::class, 'eval' => HHAST\EvalToken::class, + 'exports' => HHAST\ExportsToken::class, 'extends' => HHAST\ExtendsToken::class, 'fallthrough' => HHAST\FallthroughToken::class, 'file' => HHAST\FileToken::class, @@ -77,11 +73,11 @@ final class TokenClassMap { 'float' => HHAST\FloatToken::class, 'for' => HHAST\ForToken::class, 'foreach' => HHAST\ForeachToken::class, - 'from' => HHAST\FromToken::class, 'function' => HHAST\FunctionToken::class, 'global' => HHAST\GlobalToken::class, 'if' => HHAST\IfToken::class, 'implements' => HHAST\ImplementsToken::class, + 'imports' => HHAST\ImportsToken::class, 'include' => HHAST\IncludeToken::class, 'include_once' => HHAST\Include_onceToken::class, 'inout' => HHAST\InoutToken::class, @@ -105,6 +101,7 @@ final class TokenClassMap { 'noreturn' => HHAST\NoreturnToken::class, 'null' => HHAST\NullLiteralToken::class, 'num' => HHAST\NumToken::class, + 'package' => HHAST\PackageToken::class, 'parent' => HHAST\ParentToken::class, 'print' => HHAST\PrintToken::class, 'private' => HHAST\PrivateToken::class, diff --git a/codegen/tokens/EndforeachToken.hack b/codegen/tokens/EndforeachToken.hack deleted file mode 100644 index f8f6fe385..000000000 --- a/codegen/tokens/EndforeachToken.hack +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file is generated. Do not modify it manually! - * - * @generated SignedSource<<81960eec89b6d741a7be5df556e41875>> - */ -namespace Facebook\HHAST; - -final class EndforeachToken extends TokenWithVariableText { - - const string KIND = 'endforeach'; - - public function __construct( - ?NodeList $leading, - ?NodeList $trailing, - string $token_text = 'endforeach', - ?__Private\SourceRef $source_ref = null, - ) { - parent::__construct($leading, $trailing, $token_text, $source_ref); - } -} diff --git a/codegen/tokens/EndswitchToken.hack b/codegen/tokens/EndswitchToken.hack deleted file mode 100644 index 3925039cb..000000000 --- a/codegen/tokens/EndswitchToken.hack +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file is generated. Do not modify it manually! - * - * @generated SignedSource<<188dbb98a6c56a101757fe160f5b3d4a>> - */ -namespace Facebook\HHAST; - -final class EndswitchToken extends TokenWithVariableText { - - const string KIND = 'endswitch'; - - public function __construct( - ?NodeList $leading, - ?NodeList $trailing, - string $token_text = 'endswitch', - ?__Private\SourceRef $source_ref = null, - ) { - parent::__construct($leading, $trailing, $token_text, $source_ref); - } -} diff --git a/codegen/tokens/EndwhileToken.hack b/codegen/tokens/EndwhileToken.hack deleted file mode 100644 index be90caf62..000000000 --- a/codegen/tokens/EndwhileToken.hack +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This file is generated. Do not modify it manually! - * - * @generated SignedSource<<3cb9138540246c5eff123f7bfae1765c>> - */ -namespace Facebook\HHAST; - -final class EndwhileToken extends TokenWithVariableText { - - const string KIND = 'endwhile'; - - public function __construct( - ?NodeList $leading, - ?NodeList $trailing, - string $token_text = 'endwhile', - ?__Private\SourceRef $source_ref = null, - ) { - parent::__construct($leading, $trailing, $token_text, $source_ref); - } -} diff --git a/codegen/tokens/DefineToken.hack b/codegen/tokens/ExportsToken.hack similarity index 62% rename from codegen/tokens/DefineToken.hack rename to codegen/tokens/ExportsToken.hack index 0edfc4571..448becafc 100644 --- a/codegen/tokens/DefineToken.hack +++ b/codegen/tokens/ExportsToken.hack @@ -1,18 +1,18 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<50446877c29ab548b5011e1a7368f036>> + * @generated SignedSource<> */ namespace Facebook\HHAST; -final class DefineToken extends TokenWithVariableText { +final class ExportsToken extends TokenWithVariableText { - const string KIND = 'define'; + const string KIND = 'exports'; public function __construct( ?NodeList $leading, ?NodeList $trailing, - string $token_text = 'define', + string $token_text = 'exports', ?__Private\SourceRef $source_ref = null, ) { parent::__construct($leading, $trailing, $token_text, $source_ref); diff --git a/codegen/tokens/EndforToken.hack b/codegen/tokens/ImportsToken.hack similarity index 62% rename from codegen/tokens/EndforToken.hack rename to codegen/tokens/ImportsToken.hack index eee2937b4..6cae2c4fc 100644 --- a/codegen/tokens/EndforToken.hack +++ b/codegen/tokens/ImportsToken.hack @@ -1,18 +1,18 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<119c6611b46cac4b5f8b4823d51d3019>> + * @generated SignedSource<<04e5f0cbb9ffebdb04a84f7fb3b4128e>> */ namespace Facebook\HHAST; -final class EndforToken extends TokenWithVariableText { +final class ImportsToken extends TokenWithVariableText { - const string KIND = 'endfor'; + const string KIND = 'imports'; public function __construct( ?NodeList $leading, ?NodeList $trailing, - string $token_text = 'endfor', + string $token_text = 'imports', ?__Private\SourceRef $source_ref = null, ) { parent::__construct($leading, $trailing, $token_text, $source_ref); diff --git a/codegen/tokens/FromToken.hack b/codegen/tokens/PackageToken.hack similarity index 62% rename from codegen/tokens/FromToken.hack rename to codegen/tokens/PackageToken.hack index b97e421b7..23258c00f 100644 --- a/codegen/tokens/FromToken.hack +++ b/codegen/tokens/PackageToken.hack @@ -1,18 +1,18 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<0e3438da122e84e68490e2a995a51346>> + * @generated SignedSource<> */ namespace Facebook\HHAST; -final class FromToken extends TokenWithVariableText { +final class PackageToken extends TokenWithVariableText { - const string KIND = 'from'; + const string KIND = 'package'; public function __construct( ?NodeList $leading, ?NodeList $trailing, - string $token_text = 'from', + string $token_text = 'package', ?__Private\SourceRef $source_ref = null, ) { parent::__construct($leading, $trailing, $token_text, $source_ref); diff --git a/codegen/version.hack b/codegen/version.hack index deb334c75..1a31df4ba 100644 --- a/codegen/version.hack +++ b/codegen/version.hack @@ -1,12 +1,12 @@ /** * This file is generated. Do not modify it manually! * - * @generated SignedSource<<0a14dbb5e6a18259e6f111c151fc1e94>> + * @generated SignedSource<<2d56b007d66fd10b21da1acfd0310b6e>> */ namespace Facebook\HHAST; -const string SCHEMA_VERSION = '2022-05-16-0000'; +const string SCHEMA_VERSION = '2022-09-29-0000'; -const int HHVM_VERSION_ID = 416300; +const int HHVM_VERSION_ID = 417300; -const string HHVM_VERSION = '4.163.0-dev'; +const string HHVM_VERSION = '4.173.0-dev'; diff --git a/composer.json b/composer.json index e1a0e8e5b..2592fab3d 100644 --- a/composer.json +++ b/composer.json @@ -1,34 +1,34 @@ { - "name": "hhvm/hhast", - "description": "A mutable AST library for Hack with linting and code migrations", - "bin": [ - "bin/hhast-lint", - "bin/hhast-lint.hack", - "bin/hhast-migrate", - "bin/hhast-migrate.hack" - ], - "license": "MIT", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev", - "dev-main": "4.x-dev" - } - }, - "require-dev": { - "facebook/fbexpect": "^2.8.1", - "facebook/hack-codegen": "^4.0", - "hhvm/hhvm-autoload": "^2.0.4|^3.0", - "hhvm/hacktest": "^2.3.0" - }, - "require": { - "hhvm": "^4.161", - "hhvm/type-assert": "^4.2.2", - "facebook/hh-clilib": "^2.5.0rc1", - "facebook/difflib": "^1.0.0" - }, - "config": { - "allow-plugins": { - "hhvm/hhvm-autoload": true - } + "name": "hhvm/hhast", + "description": "A mutable AST library for Hack with linting and code migrations", + "bin": [ + "bin/hhast-lint", + "bin/hhast-lint.hack", + "bin/hhast-migrate", + "bin/hhast-migrate.hack" + ], + "license": "MIT", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev", + "dev-main": "4.x-dev" } + }, + "require-dev": { + "facebook/fbexpect": "^2.8.1", + "facebook/hack-codegen": "^4.0", + "hhvm/hhvm-autoload": "^2.0.4|^3.0", + "hhvm/hacktest": "^2.3.0" + }, + "require": { + "hhvm": "^4.173", + "hhvm/type-assert": "^4.2.2", + "facebook/hh-clilib": "^2.5.0rc1", + "facebook/difflib": "^1.0.0" + }, + "config": { + "allow-plugins": { + "hhvm/hhvm-autoload": true + } + } }