Switch mergeDependencies to use a set.