Fix breaking in foreach
commitbf832238833cb4e3ee3b5fd55e9b5d0b70d4a12f
authorJake Bailey <jakebailey@fb.com>
Fri, 23 Jun 2017 00:09:57 +0000 (22 17:09 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Fri, 23 Jun 2017 00:29:46 +0000 (22 17:29 -0700)
tree79da22f736cd759b9e9ef88c41835afb459e5e2a
parentbb84afb916972f73bf5849829239b6535dfc1d56
Fix breaking in foreach

Summary:
Like CatchClause in D5267011, ForeachStatement's transform produced `Split`s without a containing `WithRule` block, causing the breaking of foreach statements to be erroneously dependent on some irrelevant containing rule.

This diff adds a `delimited_nest` (which provides a containing `WithRule` block) and some additional independent Splits (to get better behavior in the presence of line overflow).

Depends on D5278861

Reviewed By: arxanas

Differential Revision: D5279474

fbshipit-source-id: 387f4faec54564a1e4ab09b585cf0a576f44c78c
hphp/hack/src/hackfmt/hack_format.ml
hphp/hack/test/hackfmt/tests/foreach_overflow.php [new file with mode: 0644]
hphp/hack/test/hackfmt/tests/foreach_overflow.php.exp [new file with mode: 0644]
hphp/hack/test/hackfmt/tests/foreach_simple.php [new file with mode: 0644]
hphp/hack/test/hackfmt/tests/foreach_simple.php.exp [new file with mode: 0644]