Fix properly function type matching and propagation

Previous fix was wrong as it reverts direction of propagation.
This fix contain beside correct fix also improved documentation
so now it should be easy to see what direction of mapping for
function match.