Fix for #1671: Make sure we use substituted types for the value type of parameters

Otherwise we think that Integer.divides has a parameter of type Other rather than
Integer.
Test for #1671: another boxing issue