Mitigate the effect of T25936918 on typing of idx
Summary:
A majority of, if not all, instances of T25936918 in www arise from the function `idx`. We don't have a proper fix for T25936918, but we can mitigate the problem by changing the way the type signature of `idx` is rewritten internally by the type checker: instead of
```
idx<Tk, Tv>(?KeyedContainer<Tk, Tv> $collection, ?Tk $index): ?Tv
```
we can use
```
idx<Tk, Tv>(?KeyedContainer<Tk, ?Tv> $collection, ?Tk $index): ?Tv
```
(Note that `KeyedContainer<Tk, Tv>` is covariant in `Tv`.)
As an alternative, I've considered changing the type of `idx` specified in `idx.hhi` to
```
function idx<Tk, Tv>(
?KeyedContainer<Tk, Tv> $collection,
?Tk $index,
Tv $default,
): Tv {}
```
and rewriting the argument list by passing extra `null` if `idx` is called with 2 arguments. This works but because I have to manufacture `null` out of thin air, there is no position information associated with it and error messages can sometimes be confusing. The implementation of typing simplifies though.
I've tried running the new version of the type checker on www (with `nonnull` enabled). Surprisingly, this revealed some new errors that don't look directly related but that I think are valid:
D7111140. On the other hand, I was able to remove some of the previously introduced `HH_FIXME`s:
D7111145. (I believe those are all `HH_FIXME` that I had to add because of this bug.)
Reviewed By: dlreeves
Differential Revision:
D7111132
fbshipit-source-id:
f4f241df262fc03d670886e2fd071b0060113d71