Remove some string checks from the default path for typing function calls
Summary:
I noticed these string checks were happening every single function call, so I put the relevant strings in a `Hash_set` and do the slower checking if that passes. For shapes `Shapes::`, the restructure won't be much faster since each branch always checked the class name first, but it does fewer checks in the case when a Shapes:: function is encountered.
Besides the performance improvement, a nice benefit of this change is that the outer `match` for dispatch_call folds up to
```
match fun_expr with
(* Special top-level function *)
| Id ((p, x) as id) when SN.StdlibFunctions.needs_special_dispatch x -> ...
(* Special Shapes:: function *)
| Class_const (((_, CI (_, shapes)) as class_id), ((_, x) as method_id))
when String.equal shapes SN.Shapes.cShapes -> ...
(* Special function `parent::__construct` *)
| Class_const ((pos, CIparent), ((_, construct) as id))
when String.equal construct SN.Members.__construct -> ...
(* Calling parent / class method *)
| Class_const (class_id, m) -> dispatch_class_const env class_id m
(* Call instance method *)
| Obj_get (e1, (pos_id, Id m), nullflavor, false)
when not (TypecheckerOptions.method_call_inference (Env.get_tcopt env)) -> ...
(* Call instance method using new method call inference *)
| Obj_get (receiver, (pos_id, Id meth), nullflavor, false) -> ...
(* Function invocation *)
| Fun_id x -> ...
| Id id -> dispatch_id env id
| _ -> ...
```
which is quite a bit easier to follow.
Reviewed By: losvald
Differential Revision:
D25729833
fbshipit-source-id:
fb28e12095835dde5616d5f072fdfdfbae7a4b5a