BUG: Make type_tuple_type_resolver more robust.
BUG: Make type_tuple_type_resolver more robust.

When a loop match fails on account of casting, continue searching the
loops until success or all loops have been examined. The failure to do
this was causing true_divide to fail with float inputs and dtype=float
because the first loop found was (int8, int8, float64), leading to a
casting error as float cannot be safely cast to int8. Versions of numpy
previous to 1.10 will still fail silently if this is backported as the
casting rules were less strict, so that would also need fixing.

Closes #3484.

githubmlai/numpy,seberg/numpy,KaelChen/numpy,sonnyhu/numpy,Eric89GXL/numpy,mhvk/numpy,MSeifert04/numpy,mingwpy/numpy,seberg/numpy,charris/numpy,kiwifb/numpy,ahaldane/numpy,simongibbons/numpy,gfyoung/numpy,groutr/numpy,bringingheavendown/numpy,gmcastil/numpy,ESSS/numpy,jakirkham/numpy,anntzer/numpy,rherault-insa/numpy,SiccarPoint/numpy,pbrod/numpy,Anwesh43/numpy,trankmichael/numpy,jankoslavic/numpy,trankmichael/numpy,gmcastil/numpy,nbeaver/numpy,pbrod/numpy,behzadnouri/numpy,grlee77/numpy,ChanderG/numpy,BabeNovelty/numpy,dwillmer/numpy,stuarteberg/numpy,Dapid/numpy,ChristopherHogan/numpy,jschueller/numpy,BabeNovelty/numpy,ahaldane/numpy,solarjoe/numpy,leifdenby/numpy,moreati/numpy,mhvk/numpy,ChanderG/numpy,Yusa95/numpy,rhythmsosad/numpy,rajathkumarmp/numpy,leifdenby/numpy,pyparallel/numpy,WarrenWeckesser/numpy,cjermain/numpy,felipebetancur/numpy,kirillzhuravlev/numpy,pdebuyl/numpy,jakirkham/numpy,numpy/numpy,MichaelAquilina/numpy,ahaldane/numpy,KaelChen/numpy,anntzer/numpy,chatcannon/numpy,hainm/numpy,pyparallel/numpy,ChristopherHogan/numpy,pdebuyl/numpy,chatcannon/numpy,musically-ut/numpy,cjermain/numpy,MaPePeR/numpy,jorisvandenbossche/numpy,felipebetancur/numpy,felipebetancur/numpy,pbrod/numpy,madphysicist/numpy,mwiebe/numpy,Srisai85/numpy,mattip/numpy,SunghanKim/numpy,skwbc/numpy,joferkington/numpy,WarrenWeckesser/numpy,mathdd/numpy,musically-ut/numpy,mhvk/numpy,AustereCuriosity/numpy,sinhrks/numpy,maniteja123/numpy,GrimDerp/numpy,mingwpy/numpy,sinhrks/numpy,felipebetancur/numpy,mattip/numpy,maniteja123/numpy,KaelChen/numpy,Anwesh43/numpy,bmorris3/numpy,hainm/numpy,Srisai85/numpy,njase/numpy,ViralLeadership/numpy,AustereCuriosity/numpy,chiffa/numpy,GrimDerp/numpy,b-carter/numpy,seberg/numpy,b-carter/numpy,ViralLeadership/numpy,anntzer/numpy,shoyer/numpy,seberg/numpy,musically-ut/numpy,chiffa/numpy,Srisai85/numpy,simongibbons/numpy,rhythmsosad/numpy,GaZ3ll3/numpy,jonathanunderwood/numpy,endolith/numpy,njase/numpy,MSeifert04/numpy,sinhrks/numpy,grlee77/numpy,SiccarPoint/numpy,solarjoe/numpy,MSeifert04/numpy,utke1/numpy,nbeaver/numpy,Dapid/numpy,skymanaditya1/numpy,shoyer/numpy,SunghanKim/numpy,WarrenWeckesser/numpy,numpy/numpy,argriffing/numpy,ContinuumIO/numpy,SiccarPoint/numpy,numpy/numpy,Yusa95/numpy,WarrenWeckesser/numpy,ESSS/numpy,grlee77/numpy,madphysicist/numpy,sonnyhu/numpy,bringingheavendown/numpy,mathdd/numpy,bertrand-l/numpy,CMartelLML/numpy,KaelChen/numpy,stuarteberg/numpy,empeeu/numpy,argriffing/numpy,joferkington/numpy,tynn/numpy,Anwesh43/numpy,endolith/numpy,utke1/numpy,ddasilva/numpy,rajathkumarmp/numpy,ChanderG/numpy,ChanderG/numpy,cjermain/numpy,mingwpy/numpy,MSeifert04/numpy,charris/numpy,skymanaditya1/numpy,dimasad/numpy,trankmichael/numpy,bringingheavendown/numpy,cjermain/numpy,solarjoe/numpy,jorisvandenbossche/numpy,stuarteberg/numpy,pizzathief/numpy,simongibbons/numpy,groutr/numpy,pizzathief/numpy,pbrod/numpy,jankoslavic/numpy,abalkin/numpy,rgommers/numpy,ContinuumIO/numpy,jonathanunderwood/numpy,tacaswell/numpy,rherault-insa/numpy,Eric89GXL/numpy,githubmlai/numpy,MSeifert04/numpy,trankmichael/numpy,pizzathief/numpy,drasmuss/numpy,jorisvandenbossche/numpy,charris/numpy,Linkid/numpy,shoyer/numpy,argriffing/numpy,tacaswell/numpy,jankoslavic/numpy,bmorris3/numpy,skymanaditya1/numpy,bertrand-l/numpy,gmcastil/numpy,mwiebe/numpy,grlee77/numpy,mwiebe/numpy,stuarteberg/numpy,jorisvandenbossche/numpy,has2k1/numpy,ChristopherHogan/numpy,ChristopherHogan/numpy,WarrenWeckesser/numpy,Linkid/numpy,has2k1/numpy,madphysicist/numpy,MichaelAquilina/numpy,dwillmer/numpy,GrimDerp/numpy,Eric89GXL/numpy,ekalosak/numpy,rudimeier/numpy,Linkid/numpy,bmorris3/numpy,WillieMaddox/numpy,nguyentu1602/numpy,pizzathief/numpy,utke1/numpy,jakirkham/numpy,behzadnouri/numpy,Yusa95/numpy,jankoslavic/numpy,joferkington/numpy,simongibbons/numpy,madphysicist/numpy,anntzer/numpy,chatcannon/numpy,shoyer/numpy,ekalosak/numpy,abalkin/numpy,pyparallel/numpy,pdebuyl/numpy,CMartelLML/numpy,mathdd/numpy,CMartelLML/numpy,rajathkumarmp/numpy,jschueller/numpy,jakirkham/numpy,dimasad/numpy,pbrod/numpy,ekalosak/numpy,nguyentu1602/numpy,skymanaditya1/numpy,ViralLeadership/numpy,hainm/numpy,simongibbons/numpy,moreati/numpy,rhythmsosad/numpy,Yusa95/numpy,MichaelAquilina/numpy,mhvk/numpy,ssanderson/numpy,skwbc/numpy,moreati/numpy,jschueller/numpy,mattip/numpy,jorisvandenbossche/numpy,tynn/numpy,drasmuss/numpy,pdebuyl/numpy,bmorris3/numpy,GaZ3ll3/numpy,CMartelLML/numpy,charris/numpy,joferkington/numpy,rgommers/numpy,empeeu/numpy,ssanderson/numpy,Srisai85/numpy,b-carter/numpy,SunghanKim/numpy,bertrand-l/numpy,rudimeier/numpy,groutr/numpy,abalkin/numpy,mhvk/numpy,WillieMaddox/numpy,sonnyhu/numpy,rudimeier/numpy,AustereCuriosity/numpy,ekalosak/numpy,kiwifb/numpy,rajathkumarmp/numpy,shoyer/numpy,nbeaver/numpy,skwbc/numpy,BabeNovelty/numpy,GaZ3ll3/numpy,rherault-insa/numpy,MaPePeR/numpy,tynn/numpy,MaPePeR/numpy,numpy/numpy,empeeu/numpy,gfyoung/numpy,sinhrks/numpy,endolith/numpy,rgommers/numpy,ahaldane/numpy,empeeu/numpy,dimasad/numpy,kiwifb/numpy,endolith/numpy,githubmlai/numpy,SiccarPoint/numpy,Anwesh43/numpy,behzadnouri/numpy,nguyentu1602/numpy,kirillzhuravlev/numpy,WillieMaddox/numpy,gfyoung/numpy,MaPePeR/numpy,drasmuss/numpy,hainm/numpy,dwillmer/numpy,jakirkham/numpy,kirillzhuravlev/numpy,ssanderson/numpy,Linkid/numpy,rgommers/numpy,kirillzhuravlev/numpy,Dapid/numpy,musically-ut/numpy,mathdd/numpy,maniteja123/numpy,GrimDerp/numpy,pizzathief/numpy,rhythmsosad/numpy,jschueller/numpy,dimasad/numpy,SunghanKim/numpy,mattip/numpy,jonathanunderwood/numpy,githubmlai/numpy,BabeNovelty/numpy,MichaelAquilina/numpy,dwillmer/numpy,ESSS/numpy,GaZ3ll3/numpy,tacaswell/numpy,leifdenby/numpy,njase/numpy,chiffa/numpy,ContinuumIO/numpy,ahaldane/numpy,madphysicist/numpy,has2k1/numpy,Eric89GXL/numpy,ddasilva/numpy,nguyentu1602/numpy,sonnyhu/numpy,rudimeier/numpy,ddasilva/numpy,grlee77/numpy,mingwpy/numpy,has2k1/numpy