Readonly closure calls
Summary:
This diff forbids a readonly closure that was not marked readonly at the declaration site to be called. Since this is relatively confusing behavior, the error message tries to suggest reasonable alternatives when trying to call a readonly closure.
- If it sees the readonly closure from a typehint, it will suggest marking the typehint as `(readonly function() : ..)`.
- If it sees the readonly closure from a declaration it will suggest adding readonly to the declaration.
Note that this does not handle more complex cases where the type is not a single Tfun but a Tunion or Tintersection: I will address this in a later diff.
Reviewed By: losvald
Differential Revision:
D27304014
fbshipit-source-id:
5625c5dd256caf58aa97f22d94093744ed1bdd1f