Add test for when specialization types conflict

This commit is contained in:
Ayaz Hafiz 2022-04-12 19:01:36 -04:00
parent cf1a6691dd
commit 67b5ab7fe7
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 44 additions and 4 deletions

View file

@ -1319,10 +1319,8 @@ fn check_ability_specialization(
.filter(|mia| mia.ability == root_data.parent_ability)
.collect::<Vec<_>>();
ability_implementations_for_specialization.dedup();
debug_assert_eq!(
ability_implementations_for_specialization.len(), 1,
"If there's more than one, the definition is ambiguous - this should be an error"
);
debug_assert!(ability_implementations_for_specialization.len() == 1, "Multiple variables bound to an ability - this is ambiguous and should have been caught in canonicalization");
// This is a valid specialization! Record it.
let specialization_type = ability_implementations_for_specialization[0].typ;