types: take into account arguments number when resolving functions