My assumption is that elements defined with name+type and elements with only a ref should always be considered as different. So for considering elements to not be different the comparison is always done name vs. name and ref vs. ref.