diff --git a/src/protocol/tests/utils.rs b/src/protocol/tests/utils.rs index 461d2207031d776df65f16a2c52952449c5a7e4a..d599014400b8b193e8bded700bdcba2fdfeafb65 100644 --- a/src/protocol/tests/utils.rs +++ b/src/protocol/tests/utils.rs @@ -296,8 +296,8 @@ impl<'a> StructTester<'a> { pub(crate) fn assert_size_alignment(mut self, monomorph: &str, size: usize, alignment: usize) -> Self { self = self.assert_has_monomorph(monomorph); let (mono_idx, _) = has_monomorph(self.ctx, self.ast_def.this.upcast(), monomorph); - let mono_idx = mono_idx.unwrap(); - let mono = self.ctx.types.get_monomorph(mono_idx); + let type_id = mono_idx.unwrap(); + let mono = self.ctx.types.get_monomorph(type_id); assert!( mono.size == size && mono.alignment == alignment, @@ -702,7 +702,7 @@ impl<'a> FunctionTester<'a> { // Assuming the function is not polymorphic let definition_id = self.def.this.upcast(); let func_type = [ConcreteTypePart::Function(definition_id, 0)]; - let mono_index = self.ctx.types.get_procedure_monomorph_index(&definition_id, &func_type).unwrap(); + let mono_index = self.ctx.types.get_procedure_monomorph_type_id(&definition_id, &func_type).unwrap(); let mut prompt = Prompt::new(&self.ctx.types, &self.ctx.heap, self.def.this.upcast(), mono_index, ValueGroup::new_stack(Vec::new())); let mut call_context = FakeRunContext{}; @@ -816,7 +816,7 @@ fn get_procedure_monomorph<'a>(heap: &Heap, types: &'a TypeTable, definition_id: unreachable!() }; - let mono_index = types.get_procedure_monomorph_index(&definition_id, &func_type).unwrap(); + let mono_index = types.get_procedure_monomorph_type_id(&definition_id, &func_type).unwrap(); let mono_data = types.get_procedure_monomorph(mono_index); mono_data @@ -926,7 +926,7 @@ fn has_equal_num_monomorphs(ctx: TestCtx, num: usize, definition_id: DefinitionI // Again: inefficient, but its testing code let mut num_on_type = 0; - for mono in &ctx.types.mono_lookup.monomorphs { + for mono in &ctx.types.mono_types { match &mono.concrete_type.parts[0] { ConcreteTypePart::Instance(def_id, _) | ConcreteTypePart::Function(def_id, _) | @@ -942,13 +942,13 @@ fn has_equal_num_monomorphs(ctx: TestCtx, num: usize, definition_id: DefinitionI (num_on_type == num, num_on_type) } -fn has_monomorph(ctx: TestCtx, definition_id: DefinitionId, serialized_monomorph: &str) -> (Option, String) { +fn has_monomorph(ctx: TestCtx, definition_id: DefinitionId, serialized_monomorph: &str) -> (Option, String) { // Note: full_buffer is just for error reporting let mut full_buffer = String::new(); let mut has_match = None; full_buffer.push('['); - let mut append_to_full_buffer = |concrete_type: &ConcreteType, mono_idx: usize| { + let mut append_to_full_buffer = |concrete_type: &ConcreteType, type_id: TypeId| { if full_buffer.len() != 1 { full_buffer.push_str(", "); } @@ -957,14 +957,14 @@ fn has_monomorph(ctx: TestCtx, definition_id: DefinitionId, serialized_monomorph let first_idx = full_buffer.len(); full_buffer.push_str(concrete_type.display_name(ctx.heap).as_str()); if &full_buffer[first_idx..] == serialized_monomorph { - has_match = Some(mono_idx as i32); + has_match = Some(type_id); } full_buffer.push('"'); }; // Bit wasteful, but this is (temporary?) testing code: - for (mono_idx, mono) in ctx.types.mono_lookup.monomorphs.iter().enumerate() { + for (mono_idx, mono) in ctx.types.mono_types.iter().enumerate() { let got_definition_id = match &mono.concrete_type.parts[0] { ConcreteTypePart::Instance(v, _) | ConcreteTypePart::Function(v, _) | @@ -972,7 +972,7 @@ fn has_monomorph(ctx: TestCtx, definition_id: DefinitionId, serialized_monomorph _ => DefinitionId::new_invalid(), }; if got_definition_id == definition_id { - append_to_full_buffer(&mono.concrete_type, mono_idx); + append_to_full_buffer(&mono.concrete_type, mono.type_id); } }