add remap to codegen for functions

The important change here is that the return value in a function needs to be of the correct type. 
- Either the type is not generated (as is done here) and we depend on the Scala compiler downstream to do the right thing
- Or we add a remap(y.tp)

This change is necessary when generating code with structs.