Factor out the derivation of type witnesses for compiler-assisted protocols.
Factor out the derivation of type witnesses for compiler-assisted protocols.

There is a tiny semantic tweak here, because we only derive type
witnesses as a last resort, preferring to deduce the assocated type
from (say) an explicitly-specified fromRaw/toRaw. In such cases, the
specified underlying type can differ from the raw type, which is fine.



Swift SVN r11420

ahoppen/swift,karwa/swift,parkera/swift,ben-ng/swift,stephentyrone/swift,Ivacker/swift,natecook1000/swift,arvedviehweger/swift,modocache/swift,xedin/swift,zisko/swift,harlanhaskins/swift,hughbe/swift,alblue/swift,KrishMunot/swift,tinysun212/swift-windows,adrfer/swift,tjw/swift,emilstahl/swift,mightydeveloper/swift,return/swift,return/swift,gottesmm/swift,tardieu/swift,Ivacker/swift,cbrentharris/swift,dduan/swift,huonw/swift,practicalswift/swift,nathawes/swift,CodaFi/swift,zisko/swift,tardieu/swift,shahmishal/swift,milseman/swift,felix91gr/swift,lorentey/swift,kperryua/swift,devincoughlin/swift,deyton/swift,jmgc/swift,gregomni/swift,natecook1000/swift,emilstahl/swift,xedin/swift,SwiftAndroid/swift,cbrentharris/swift,LeoShimonaka/swift,deyton/swift,ben-ng/swift,djwbrown/swift,LeoShimonaka/swift,tjw/swift,xedin/swift,ahoppen/swift,frootloops/swift,apple/swift,stephentyrone/swift,jckarter/swift,IngmarStein/swift,rudkx/swift,jtbandes/swift,ahoppen/swift,rudkx/swift,austinzheng/swift,tkremenek/swift,ben-ng/swift,jmgc/swift,mightydeveloper/swift,gmilos/swift,xedin/swift,xwu/swift,natecook1000/swift,JaSpa/swift,dduan/swift,arvedviehweger/swift,swiftix/swift.old,swiftix/swift.old,OscarSwanros/swift,uasys/swift,tardieu/swift,sschiau/swift,deyton/swift,shajrawi/swift,gregomni/swift,brentdax/swift,dduan/swift,hooman/swift,brentdax/swift,airspeedswift/swift,hughbe/swift,kentya6/swift,hughbe/swift,xedin/swift,tkremenek/swift,swiftix/swift.old,swiftix/swift.old,ahoppen/swift,jmgc/swift,lorentey/swift,zisko/swift,calebd/swift,brentdax/swift,danielmartin/swift,apple/swift,glessard/swift,djwbrown/swift,johnno1962d/swift,apple/swift,calebd/swift,SwiftAndroid/swift,roambotics/swift,johnno1962d/swift,atrick/swift,russbishop/swift,jtbandes/swift,austinzheng/swift,shajrawi/swift,LeoShimonaka/swift,calebd/swift,tjw/swift,allevato/swift,JaSpa/swift,jtbandes/swift,gottesmm/swift,rudkx/swift,KrishMunot/swift,aschwaighofer/swift,gregomni/swift,kentya6/swift,arvedviehweger/swift,Jnosh/swift,Jnosh/swift,jmgc/swift,JaSpa/swift,frootloops/swift,huonw/swift,gmilos/swift,swiftix/swift,xwu/swift,devincoughlin/swift,slavapestov/swift,atrick/swift,LeoShimonaka/swift,airspeedswift/swift,shajrawi/swift,kusl/swift,kentya6/swift,SwiftAndroid/swift,austinzheng/swift,amraboelela/swift,KrishMunot/swift,codestergit/swift,milseman/swift,codestergit/swift,shahmishal/swift,alblue/swift,kstaring/swift,swiftix/swift,hughbe/swift,huonw/swift,manavgabhawala/swift,ben-ng/swift,CodaFi/swift,JaSpa/swift,return/swift,jckarter/swift,austinzheng/swift,rudkx/swift,emilstahl/swift,tardieu/swift,ahoppen/swift,modocache/swift,deyton/swift,MukeshKumarS/Swift,sdulal/swift,tjw/swift,jtbandes/swift,karwa/swift,johnno1962d/swift,JGiola/swift,lorentey/swift,adrfer/swift,lorentey/swift,shahmishal/swift,parkera/swift,gottesmm/swift,codestergit/swift,mightydeveloper/swift,khizkhiz/swift,gregomni/swift,therealbnut/swift,cbrentharris/swift,Jnosh/swift,xedin/swift,stephentyrone/swift,bitjammer/swift,Ivacker/swift,allevato/swift,karwa/swift,cbrentharris/swift,uasys/swift,calebd/swift,slavapestov/swift,jtbandes/swift,brentdax/swift,jckarter/swift,emilstahl/swift,tardieu/swift,dduan/swift,jopamer/swift,ken0nek/swift,lorentey/swift,apple/swift,khizkhiz/swift,stephentyrone/swift,ken0nek/swift,natecook1000/swift,slavapestov/swift,russbishop/swift,jopamer/swift,swiftix/swift,zisko/swift,gottesmm/swift,MukeshKumarS/Swift,jopamer/swift,karwa/swift,IngmarStein/swift,gribozavr/swift,hughbe/swift,milseman/swift,sschiau/swift,parkera/swift,shahmishal/swift,huonw/swift,tinysun212/swift-windows,danielmartin/swift,uasys/swift,atrick/swift,sschiau/swift,kusl/swift,MukeshKumarS/Swift,natecook1000/swift,sdulal/swift,karwa/swift,LeoShimonaka/swift,sdulal/swift,CodaFi/swift,kperryua/swift,parkera/swift,kusl/swift,kusl/swift,deyton/swift,brentdax/swift,roambotics/swift,austinzheng/swift,IngmarStein/swift,amraboelela/swift,CodaFi/swift,karwa/swift,slavapestov/swift,MukeshKumarS/Swift,arvedviehweger/swift,tinysun212/swift-windows,shahmishal/swift,shahmishal/swift,harlanhaskins/swift,zisko/swift,uasys/swift,harlanhaskins/swift,nathawes/swift,mightydeveloper/swift,SwiftAndroid/swift,devincoughlin/swift,tkremenek/swift,stephentyrone/swift,SwiftAndroid/swift,parkera/swift,hooman/swift,sdulal/swift,frootloops/swift,felix91gr/swift,therealbnut/swift,kentya6/swift,ben-ng/swift,djwbrown/swift,huonw/swift,dreamsxin/swift,devincoughlin/swift,kentya6/swift,practicalswift/swift,tinysun212/swift-windows,huonw/swift,therealbnut/swift,kstaring/swift,danielmartin/swift,manavgabhawala/swift,rudkx/swift,KrishMunot/swift,kperryua/swift,uasys/swift,dduan/swift,MukeshKumarS/Swift,lorentey/swift,devincoughlin/swift,tkremenek/swift,therealbnut/swift,calebd/swift,IngmarStein/swift,sschiau/swift,ken0nek/swift,danielmartin/swift,JGiola/swift,atrick/swift,slavapestov/swift,emilstahl/swift,allevato/swift,russbishop/swift,glessard/swift,LeoShimonaka/swift,felix91gr/swift,tinysun212/swift-windows,sschiau/swift,cbrentharris/swift,gregomni/swift,zisko/swift,amraboelela/swift,khizkhiz/swift,russbishop/swift,kusl/swift,xedin/swift,manavgabhawala/swift,alblue/swift,return/swift,JaSpa/swift,swiftix/swift.old,khizkhiz/swift,parkera/swift,amraboelela/swift,bitjammer/swift,xwu/swift,sdulal/swift,tjw/swift,Jnosh/swift,cbrentharris/swift,kperryua/swift,allevato/swift,danielmartin/swift,mightydeveloper/swift,manavgabhawala/swift,nathawes/swift,JGiola/swift,JGiola/swift,glessard/swift,ben-ng/swift,brentdax/swift,hooman/swift,Ivacker/swift,gribozavr/swift,practicalswift/swift,gottesmm/swift,CodaFi/swift,IngmarStein/swift,sschiau/swift,tjw/swift,xwu/swift,alblue/swift,IngmarStein/swift,shajrawi/swift,felix91gr/swift,nathawes/swift,gribozavr/swift,shajrawi/swift,glessard/swift,tinysun212/swift-windows,JGiola/swift,xwu/swift,hooman/swift,adrfer/swift,harlanhaskins/swift,kusl/swift,kusl/swift,danielmartin/swift,OscarSwanros/swift,aschwaighofer/swift,nathawes/swift,jckarter/swift,JaSpa/swift,jmgc/swift,return/swift,atrick/swift,zisko/swift,SwiftAndroid/swift,practicalswift/swift,uasys/swift,emilstahl/swift,swiftix/swift,karwa/swift,JGiola/swift,gribozavr/swift,tkremenek/swift,swiftix/swift,Jnosh/swift,djwbrown/swift,russbishop/swift,practicalswift/swift,kentya6/swift,milseman/swift,tkremenek/swift,frootloops/swift,johnno1962d/swift,calebd/swift,jckarter/swift,roambotics/swift,russbishop/swift,kentya6/swift,sschiau/swift,adrfer/swift,tinysun212/swift-windows,khizkhiz/swift,shajrawi/swift,huonw/swift,amraboelela/swift,stephentyrone/swift,rudkx/swift,arvedviehweger/swift,xwu/swift,adrfer/swift,mightydeveloper/swift,aschwaighofer/swift,bitjammer/swift,jmgc/swift,khizkhiz/swift,therealbnut/swift,lorentey/swift,gregomni/swift,jckarter/swift,swiftix/swift.old,calebd/swift,kperryua/swift,johnno1962d/swift,jopamer/swift,aschwaighofer/swift,devincoughlin/swift,kstaring/swift,mightydeveloper/swift,ken0nek/swift,sdulal/swift,devincoughlin/swift,danielmartin/swift,jopamer/swift,benlangmuir/swift,Ivacker/swift,Jnosh/swift,roambotics/swift,djwbrown/swift,gribozavr/swift,bitjammer/swift,codestergit/swift,kstaring/swift,hooman/swift,Ivacker/swift,gottesmm/swift,codestergit/swift,hughbe/swift,xwu/swift,OscarSwanros/swift,SwiftAndroid/swift,harlanhaskins/swift,jckarter/swift,frootloops/swift,aschwaighofer/swift,atrick/swift,milseman/swift,xedin/swift,benlangmuir/swift,modocache/swift,bitjammer/swift,slavapestov/swift,allevato/swift,natecook1000/swift,KrishMunot/swift,swiftix/swift,codestergit/swift,arvedviehweger/swift,airspeedswift/swift,ahoppen/swift,aschwaighofer/swift,felix91gr/swift,austinzheng/swift,nathawes/swift,benlangmuir/swift,alblue/swift,practicalswift/swift,apple/swift,johnno1962d/swift,austinzheng/swift,adrfer/swift,cbrentharris/swift,felix91gr/swift,frootloops/swift,amraboelela/swift,bitjammer/swift,gribozavr/swift,airspeedswift/swift,MukeshKumarS/Swift,airspeedswift/swift,allevato/swift,therealbnut/swift,sdulal/swift,Ivacker/swift,LeoShimonaka/swift,khizkhiz/swift,aschwaighofer/swift,jopamer/swift,dduan/swift,mightydeveloper/swift,nathawes/swift,CodaFi/swift,milseman/swift,arvedviehweger/swift,modocache/swift,hooman/swift,deyton/swift,manavgabhawala/swift,airspeedswift/swift,shajrawi/swift,kperryua/swift,kstaring/swift,lorentey/swift,codestergit/swift,CodaFi/swift,shajrawi/swift,therealbnut/swift,devincoughlin/swift,emilstahl/swift,emilstahl/swift,OscarSwanros/swift,parkera/swift,jtbandes/swift,benlangmuir/swift,OscarSwanros/swift,johnno1962d/swift,gmilos/swift,manavgabhawala/swift,karwa/swift,tkremenek/swift,slavapestov/swift,glessard/swift,gottesmm/swift,kstaring/swift,LeoShimonaka/swift,shahmishal/swift,practicalswift/swift,kentya6/swift,milseman/swift,gmilos/swift,cbrentharris/swift,ben-ng/swift,dreamsxin/swift,tardieu/swift,roambotics/swift,benlangmuir/swift,gmilos/swift,KrishMunot/swift,stephentyrone/swift,alblue/swift,OscarSwanros/swift,practicalswift/swift,natecook1000/swift,apple/swift,hughbe/swift,frootloops/swift,kstaring/swift,glessard/swift,sschiau/swift,gribozavr/swift,JaSpa/swift,shahmishal/swift,swiftix/swift.old,benlangmuir/swift,swiftix/swift,OscarSwanros/swift,sdulal/swift,return/swift,dduan/swift,jtbandes/swift,tjw/swift,KrishMunot/swift,ken0nek/swift,bitjammer/swift,russbishop/swift,adrfer/swift,roambotics/swift,MukeshKumarS/Swift,airspeedswift/swift,swiftix/swift.old,ken0nek/swift,amraboelela/swift,Ivacker/swift,brentdax/swift,jopamer/swift,alblue/swift,ken0nek/swift,kusl/swift,jmgc/swift,uasys/swift,modocache/swift,allevato/swift,Jnosh/swift,return/swift,hooman/swift,IngmarStein/swift,manavgabhawala/swift,gmilos/swift,modocache/swift,parkera/swift,djwbrown/swift,modocache/swift,felix91gr/swift,kperryua/swift,harlanhaskins/swift,djwbrown/swift,harlanhaskins/swift,tardieu/swift,deyton/swift,gmilos/swift,gribozavr/swift