improve generic dot() of abstract-typed containers. fixes #6450