Fix typehint for lambdas
Fixes #2370
Our parsing of short lambda arguments was super naive. They're basically the same thing as anonymous functions, so we need to support typehints, variadics, etc.
I can't say I love the pattern of trying to parse and seeing if it created any errors, but it works.
I also decided to add support for lambda return types. To make sure I covered everything I copied the hphp/test/quick/lambda*.php tests here, with a few small Hack related fixes (like `new bar` -> `new bar()`).
The one thing that Hack couldn't support was typing a lambda function with anonymous arguments. For example, I couldn't get this to work:
(): (function(int): int) ==> (int $x = 4): int ==> $x;
Hack thinks that the arity doesn't match between these two functions. Internally we can deal with a function type with min/max arity, we just don't have syntax to declare it. Phooey.
Reviewed By: @jdelong
Differential Revision:
D1266483