Specialize polymorphic function types when applying overloaded declaration references.
Specialize polymorphic function types when applying overloaded
declaration references.

This allows us to tighten up the assertion that only metatypes are
passing through function applications to the old type
checker. Previously, some polymorphic function types were getting
passed through.

The commented part of this test is another (unrelated) bug uncovered
by the change above, where we end up deducing a tuple type with
embedded lvalue types, which is awful.


Swift SVN r4686

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