Post: simplify type set narrowing.
This commit is contained in:
parent
cb4ba9e68f
commit
5e971f3b22
1 changed files with 2 additions and 10 deletions
|
@ -396,20 +396,12 @@ impl ConjoiningClauses {
|
||||||
// Is there an existing mapping for this variable?
|
// Is there an existing mapping for this variable?
|
||||||
// Any known inputs have already been added to known_types, and so if they conflict we'll
|
// Any known inputs have already been added to known_types, and so if they conflict we'll
|
||||||
// spot it here.
|
// spot it here.
|
||||||
if let Some(existing) = self.known_types.get(&variable).cloned() {
|
if let Some(existing) = self.known_types.insert(variable.clone(), unit_type_set(this_type)) {
|
||||||
// If so, the types must match.
|
// There was an existing mapping. Does this type match?
|
||||||
if !existing.contains(&this_type) {
|
if !existing.contains(&this_type) {
|
||||||
self.mark_known_empty(EmptyBecause::TypeMismatch(variable, existing, this_type));
|
self.mark_known_empty(EmptyBecause::TypeMismatch(variable, existing, this_type));
|
||||||
} else {
|
|
||||||
if existing.len() > 1 {
|
|
||||||
// Narrow.
|
|
||||||
self.known_types.insert(variable, unit_type_set(this_type));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// If not, record the one we just determined.
|
|
||||||
self.known_types.insert(variable, unit_type_set(this_type));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensure that the given place has the correct types to be a tx-id.
|
/// Ensure that the given place has the correct types to be a tx-id.
|
||||||
|
|
Loading…
Reference in a new issue