Use subtyping to typecheck dispatch calls for instance methods
Summary:
Instead of using `Typing_object_get.obj_get` to typecheck `Obj_get` method invocations in `dispatch_call`, create a `Thas_member` constraint and subtype it. This is similar to how property accesses are typechecked, see `Obj_get` property accesses in `expr_`.
We create a fresh type variable for the method type in the has-member constraint, and early-solve with respect to variance immediately after the subtyping check. Handling nullsafe behaviour is slightly different to property accesses: rather than making the whole method type nullable, we make only its return type nullable, only if the method receiver is nullable.
Reviewed By: CatherineGasnier
Differential Revision:
D23102851
fbshipit-source-id:
3659ca50af7fac6a02ef4b00b7baacd912d69121