From 5e971f3b229f9cc9710706157f7bc9f66799f3f4 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Tue, 21 Mar 2017 19:12:57 -0700 Subject: [PATCH] Post: simplify type set narrowing. --- query-algebrizer/src/cc.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/query-algebrizer/src/cc.rs b/query-algebrizer/src/cc.rs index 6056efe3..a74987d6 100644 --- a/query-algebrizer/src/cc.rs +++ b/query-algebrizer/src/cc.rs @@ -396,19 +396,11 @@ impl ConjoiningClauses { // 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 // spot it here. - if let Some(existing) = self.known_types.get(&variable).cloned() { - // If so, the types must match. + if let Some(existing) = self.known_types.insert(variable.clone(), unit_type_set(this_type)) { + // There was an existing mapping. Does this type match? if !existing.contains(&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)); } }