Fix incorrect UseUndeclaredVariable warnings
commit67ec381c907f1cb0c20fd7ae39bac594cce5260f
authormwilliams <mwilliams@fb.com>
Thu, 8 Aug 2013 19:01:18 +0000 (8 12:01 -0700)
committerSara Golemon <sgolemon@fb.com>
Fri, 9 Aug 2013 17:30:43 +0000 (9 10:30 -0700)
tree9a8d969d54bcdd5776da27d25f02a43209c3c6f9
parentfc59c6a00a12ad9a407a5d11949cf0386902d4d3
Fix incorrect UseUndeclaredVariable warnings

There were two bugs:

 - Methods from Systemlib traits that were imported into user
   code were still marked as system methods, so we didnt run
   type inference on them, so the parameter wasn't annotated correctly;
 - If we couldn't determine whether a function argument was by reference
   or not, we could end up marking *that* as being the thing that set
   the parameter. If later we figured out which function was being called,
   we marked it as *not* by reference, and then it looked like it was being
   used without being set.

With this diff, we set the system/user flag correctly when cloning methods,
and always mark the "declaration" of a parameter as the parameter itself.

Differential Revision: D920269
hphp/compiler/analysis/class_scope.cpp
hphp/compiler/analysis/function_scope.cpp
hphp/compiler/analysis/function_scope.h
hphp/compiler/analysis/variable_table.cpp
hphp/compiler/expression/simple_variable.cpp
hphp/test/slow/compilation/parameters.php [new file with mode: 0644]
hphp/test/slow/compilation/parameters.php.expect [new file with mode: 0644]