More precise locating of HHVM errors in foreach
commit76320247bd1f43bf082a47a801d5dbd32aa61e01
authorAndrew Kennedy <akenn@fb.com>
Fri, 22 Dec 2017 08:23:26 +0000 (22 00:23 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Fri, 22 Dec 2017 08:25:17 +0000 (22 00:25 -0800)
treeebdcc52de6f250aad4cfabd70f6266b2f411fc6c
parentc382f1c39c8f87098cf20cce93ee723f9cbaa264
More precise locating of HHVM errors in foreach

Summary:
Currently, errors that relate to the expression `e` in `foreach (e) {b}` are reported at the line of the closing brace. This diff improves the accuracy of HHVM's error reporting so that the line containing `e` is reported instead.

A future diff will improve reporting further so that the range of lines is recorded; currently, it is the *last* line of the range that is shown.

Reviewed By: paulbiss

Differential Revision: D6615883

fbshipit-source-id: ade6768743e43a37eb0d070562e445a568e02408
16 files changed:
hphp/compiler/parser/parser.cpp
hphp/compiler/parser/parser.h
hphp/test/hackc_failing_tests_quick
hphp/test/hackc_repo_failing_tests_quick
hphp/test/quick/foreach-bad.php.expectf
hphp/test/quick/keyref_error.php.expectf
hphp/test/quick/reassign_this2.php.expectf
hphp/test/slow/parser/foreach-bad1.php.expectf
hphp/test/slow/parser/foreach-bad2.php.expectf
hphp/test/slow/parser/foreach-bad3.php.expectf
hphp/test/slow/parser/foreach-bad4.php.expectf
hphp/test/slow/parser/foreach-bad5.php.expectf
hphp/test/slow/parser/foreach-bad6.php.expectf
hphp/test/slow/parser/foreach-bad7.php.expectf
hphp/test/slow/reassign_this/1495.php.expectf
hphp/test/slow/reassign_this/1496.php.expectf