Type-safe object merging
Type-safe object merging

Summary:
Given two object types `o1` and `o2`, `merge_type cx (o1, o2)` should not return
a type that is narrower than `o1 | o2`. Before this diff, we merged types that
broke this invariant. For example, `{x:T}` and `{y:U}` would be merged into a
single object type, `{x:T, y:U}`, which is too narrow.

Note that there other cases are still not type-safe, like `ArrT`. I plan to make
similar changes to those cases in follow-up diffs.

I also restricted the scope of the `create_union` helper, which produces
`UnionT` types with no location. I updated the only non-local caller to produce
a union with the correct location.

Reviewed By: avikchaudhuri

Differential Revision: D3855823

fbshipit-source-id: 16ead545038f8c5b26d543333e71f2265136e48b

MichaelDeBoey/flow,jamesgpearce/flow,ForbesLindesay/flow,gabro/flow,claudiopro/flow,jamesgpearce/flow,MichaelDeBoey/flow,popham/flow,facebook/flow,samwgoldman/flow,chenglou/flow,ylu1317/flow,chenglou/flow,JonathanUsername/flow,gabelevi/flow,popham/flow,gabro/flow,ylu1317/flow,gabro/flow,fletcherw/flow,nmote/flow,fletcherw/flow,chenglou/flow,mroch/flow,mroch/flow,popham/flow,gabelevi/flow,popham/flow,mroch/flow,fletcherw/flow,AgentME/flow,TiddoLangerak/flow,jamesgpearce/flow,gabelevi/flow,samwgoldman/flow,samwgoldman/flow,ylu1317/flow,claudiopro/flow,JonathanUsername/flow,samwgoldman/flow,facebook/flow,jgrund/flow,mroch/flow,jamesgpearce/flow,MichaelDeBoey/flow,nmote/flow,JonathanUsername/flow,nmote/flow,AgentME/flow,TiddoLangerak/flow,nmote/flow,jamesgpearce/flow,nmote/flow,gabro/flow,AprilArcus/flow,chenglou/flow,mroch/flow,TiddoLangerak/flow,ForbesLindesay/flow,ylu1317/flow,jgrund/flow,AprilArcus/flow,MichaelDeBoey/flow,ForbesLindesay/flow,gabelevi/flow,mroch/flow,claudiopro/flow,ForbesLindesay/flow,MichaelDeBoey/flow,jgrund/flow,facebook/flow,claudiopro/flow,popham/flow,AgentME/flow,chenglou/flow,AgentME/flow,popham/flow,fletcherw/flow,jgrund/flow,AgentME/flow,gabro/flow,AprilArcus/flow,jgrund/flow,AprilArcus/flow,jamesgpearce/flow,jamesgpearce/flow,facebook/flow,facebook/flow,jgrund/flow,samwgoldman/flow,fletcherw/flow,ForbesLindesay/flow,AprilArcus/flow,chenglou/flow,JonathanUsername/flow,JonathanUsername/flow,samwgoldman/flow,fletcherw/flow,mroch/flow,AprilArcus/flow,ylu1317/flow,facebook/flow,gabelevi/flow,gabelevi/flow,facebook/flow,JonathanUsername/flow,gabro/flow,gabelevi/flow,popham/flow,nmote/flow,TiddoLangerak/flow,TiddoLangerak/flow,JonathanUsername/flow,ForbesLindesay/flow,claudiopro/flow,samwgoldman/flow,nmote/flow