Disallow module declarations within a module
commit72e5aefc0bfb13b9b5be12a8c3264913ad81f6eb
authorJames Wu <jjwu@fb.com>
Tue, 21 Jun 2022 20:47:58 +0000 (21 13:47 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 21 Jun 2022 20:47:58 +0000 (21 13:47 -0700)
tree7db1ce58e153768df516ea66c677acef5cd40c58
parent954fa84a1b3695558c83ed9880e57785b230c345
Disallow module declarations within a module

Summary:
The syntax
```
module foo;
new module foo {}
```
Is confusing for various reasons, so let's ban it. In order to make unit tests still reasonably writeable, we'll allow the reverse for now, though by convention we shouldn't write it outside of tests and quick examples.

Reviewed By: oulgen

Differential Revision: D37191635

fbshipit-source-id: 1c8f81bf2e4cd56c3c495b6c90bf16d1cf2c290e
27 files changed:
hphp/hack/src/parser/modules_check.rs
hphp/hack/src/parser/syntax_error.rs
hphp/hack/test/hover/internal_keyword_class.php
hphp/hack/test/hover/internal_keyword_method.php
hphp/hack/test/typecheck/modules/enum_class_internal.php
hphp/hack/test/typecheck/modules/extend_internal_class.php
hphp/hack/test/typecheck/modules/extend_internal_interface.php
hphp/hack/test/typecheck/modules/internal_enum_typedefs.php
hphp/hack/test/typecheck/modules/internal_keyword.php
hphp/hack/test/typecheck/modules/internal_keyword.php.exp
hphp/hack/test/typecheck/modules/internal_keyword2.php
hphp/hack/test/typecheck/modules/internal_keyword2.php.exp
hphp/hack/test/typecheck/modules/module_bad_visibility.php
hphp/hack/test/typecheck/modules/module_bad_visibility.php.exp
hphp/hack/test/typecheck/modules/module_decl_and_use.php [deleted file]
hphp/hack/test/typecheck/modules/module_decl_and_use.php.exp [deleted file]
hphp/hack/test/typecheck/modules/module_declaration_within_module.php [new file with mode: 0644]
hphp/hack/test/typecheck/modules/module_declaration_within_module.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/modules/modules_xhp.php
hphp/hack/test/typecheck/modules/modules_xhp.php.exp
hphp/hack/test/typecheck/modules/newtype_internal.php
hphp/hack/test/typecheck/modules/newtype_internal_bad.php
hphp/hack/test/typecheck/modules/newtype_internal_bad.php.exp
hphp/hack/test/typecheck/modules/private_methods.php
hphp/hack/test/typecheck/modules/public_toplevel.php
hphp/test/slow/enum_class/enum_class_internal.inc [copied from hphp/hack/test/hover/internal_keyword_class.php with 54% similarity]
hphp/test/slow/enum_class/enum_class_internal.php