diff --git a/src/protocol/parser/type_table.rs b/src/protocol/parser/type_table.rs index ff31225f5d0a45f17f7bcd4fe54cbe2567d61000..3d3375ba0a9b3ee3ddfc9738dab4dcd001754640 100644 --- a/src/protocol/parser/type_table.rs +++ b/src/protocol/parser/type_table.rs @@ -36,6 +36,8 @@ * layout. */ +// Programmer note: deduplication of types is currently disabled, see the +// @Deduplication key. Tests might fail when it is re-enabled. use std::collections::HashMap; use std::hash::{Hash, Hasher}; @@ -452,10 +454,10 @@ impl MonoSearchKey { impl Hash for MonoSearchKey { fn hash(&self, state: &mut H) { for index in 0..self.parts.len() { - let (flags, part) = self.parts[index]; - if flags & Self::KEY_IN_USE != 0 { - part.hash(state); - } + let (_flags, part) = self.parts[index]; + // if flags & Self::KEY_IN_USE != 0 { @Deduplication + part.hash(state); + // } } } } @@ -469,8 +471,8 @@ impl PartialEq for MonoSearchKey { // Retrieve part and flags let (self_bits, _) = self.parts[self_index]; let (other_bits, _) = other.parts[other_index]; - let self_in_use = (self_bits & Self::KEY_IN_USE) != 0; - let other_in_use = (other_bits & Self::KEY_IN_USE) != 0; + let self_in_use = true; // (self_bits & Self::KEY_IN_USE) != 0; @Deduplication + let other_in_use = true; // (other_bits & Self::KEY_IN_USE) != 0; @Deduplication // Determine ending indices let self_end_index = self.find_end_index(self_index); @@ -2178,7 +2180,7 @@ impl TypeTable { }, // Builtin types with a single nested type CTP::Array | CTP::Slice | CTP::Input | CTP::Output | CTP::Pointer => { - debug_assert_eq!(type_parts.len(), 2); + debug_assert_eq!(type_parts[0].num_embedded(), 1); search_key.set(type_parts, &POLY_VARS_IN_USE[..1]) }, // User-defined types diff --git a/src/protocol/tests/parser_monomorphs.rs b/src/protocol/tests/parser_monomorphs.rs index 2926b727bfa3360ea90779f6de4d5f43ab281694..13098bf77ad99174c738115acb30cb71423108a0 100644 --- a/src/protocol/tests/parser_monomorphs.rs +++ b/src/protocol/tests/parser_monomorphs.rs @@ -57,7 +57,7 @@ fn test_enum_monomorphs() { // Note for reader: because the enum doesn't actually use the polymorphic // variable, we expect to have 1 monomorph: the type only has to be laid - // out once. + // out once. @Deduplication Tester::new_single_source_expect_ok( "single polymorph", " @@ -71,8 +71,10 @@ fn test_enum_monomorphs() { } " ).for_enum("Answer", |e| { e - .assert_num_monomorphs(1) - .assert_has_monomorph("Answer"); + .assert_num_monomorphs(3) + .assert_has_monomorph("Answer") + .assert_has_monomorph("Answer") + .assert_has_monomorph("Answer>>"); }); }