TODO get rid of duplicate diagnostics (looks like OverloadResolver and DeclarationResolver are partially redundant; refactor them).