replace node before unifying resolved tvars in goto
replace node before unifying resolved tvars in goto

Summary:
It's important to replace a node after goto constraints when one is unresolved,
per D3802871, but when both are resolved, things are a bit different.

We need to ensure that t1 and t2 are the same type, but that judgment might be
self-referential, causing an nontermination (observed as a stack overflow in
practice).

This diff changes goto such that we equate the tvars before recursive
unification. Thus, if the unification constraint is self-referential, Flow will
find the tvars equal and stop instead of spin in an endless loop.

Reviewed By: avikchaudhuri

Differential Revision: D5540929

fbshipit-source-id: 31d964244eb7ab684dc089e26e8bb09409574de8

popham/flow,samwgoldman/flow,gabelevi/flow,MichaelDeBoey/flow,gabelevi/flow,jamesgpearce/flow,jamesgpearce/flow,jamesgpearce/flow,TiddoLangerak/flow,mroch/flow,ylu1317/flow,mroch/flow,TiddoLangerak/flow,jamesgpearce/flow,MichaelDeBoey/flow,samwgoldman/flow,ylu1317/flow,mroch/flow,claudiopro/flow,nmote/flow,nmote/flow,mroch/flow,claudiopro/flow,popham/flow,samwgoldman/flow,ylu1317/flow,popham/flow,popham/flow,JonathanUsername/flow,mroch/flow,AgentME/flow,facebook/flow,samwgoldman/flow,MichaelDeBoey/flow,gabelevi/flow,claudiopro/flow,AgentME/flow,facebook/flow,ylu1317/flow,samwgoldman/flow,AgentME/flow,popham/flow,mroch/flow,JonathanUsername/flow,mroch/flow,nmote/flow,claudiopro/flow,popham/flow,JonathanUsername/flow,AgentME/flow,MichaelDeBoey/flow,facebook/flow,samwgoldman/flow,facebook/flow,jamesgpearce/flow,gabelevi/flow,JonathanUsername/flow,facebook/flow,MichaelDeBoey/flow,JonathanUsername/flow,TiddoLangerak/flow,jamesgpearce/flow,popham/flow,nmote/flow,claudiopro/flow,jamesgpearce/flow,JonathanUsername/flow,nmote/flow,samwgoldman/flow,AgentME/flow,TiddoLangerak/flow,facebook/flow,facebook/flow,nmote/flow,gabelevi/flow,nmote/flow,gabelevi/flow,TiddoLangerak/flow,ylu1317/flow,gabelevi/flow,JonathanUsername/flow