Forbid toplevel statements after an unbraced namespace declaration
commitbff24fa6d34cf84a0f4a5f5a42370675ad41c7ce
authorJake Bailey (Hacklang) <jakebailey@fb.com>
Thu, 8 Nov 2018 23:49:14 +0000 (8 15:49 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Mon, 12 Nov 2018 14:30:34 +0000 (12 06:30 -0800)
tree85fbc3945182071255929e934bb191856b196e25
parentcc8b1057c76265d8864b704a3cf27b27a6257cbe
Forbid toplevel statements after an unbraced namespace declaration

Summary:
It looks like we neglected to scan items following an unbraced namespace declaration in the lowerer's `post_process` helper. This resulted in failing to emit errors for toplevel statements in files which have a namespace declaration with an empty body (like the added test case test_toplevel_stmt_in_namespace.php).

This change runs the `post_process` pass over the contents of the namespace, just as we do for a braced namespace declaration.

Reviewed By: kmeht

Differential Revision: D12932603

fbshipit-source-id: 38d34ee9b010f274f5d846726a7c3edbe9545e85
hphp/hack/src/parser/full_fidelity_ast.ml
hphp/hack/test/typecheck/test_toplevel_stmt_in_braced_namespace.php [new file with mode: 0644]
hphp/hack/test/typecheck/test_toplevel_stmt_in_braced_namespace.php.exp [new file with mode: 0644]
hphp/hack/test/typecheck/test_toplevel_stmt_in_namespace.php [new file with mode: 0644]
hphp/hack/test/typecheck/test_toplevel_stmt_in_namespace.php.exp [new file with mode: 0644]