[backport] SI-6301 / SI-6572 specialization regressions 

 - Backports the parts of #1226
 - omits the warnings for overloaded symbols after typer
    - to get rid of those, we would need a few library changes
 - Adds the test case from SI-6572 provided by @ijuma after the original bug was fixed.

Review by @paulp