diff --git a/src/protocol/tests/utils.rs b/src/protocol/tests/utils.rs index 7dff07dacf06403751b5379528373bca3cd94c92..8ee104fec54e1c6076614eabee40a92c987b1f5d 100644 --- a/src/protocol/tests/utils.rs +++ b/src/protocol/tests/utils.rs @@ -59,7 +59,8 @@ impl Tester { } pub(crate) fn compile(self) -> AstTesterResult { - let mut parser = Parser::new(); + let mut parser = Parser::new(None).unwrap(); + for source in self.sources.into_iter() { let source = source.into_bytes(); let input_source = InputSource::new(String::from(""), source); @@ -600,7 +601,8 @@ impl<'a> FunctionTester<'a> { // Find the first occurrence of the expression after the definition of // the function, we'll check that it is included in the body later. - let mut outer_match_idx = self.def.span.begin.offset as usize; + let body = &self.ctx.heap[self.def.body]; + let mut outer_match_idx = body.span.begin.offset as usize; while outer_match_idx < module.source.input.len() { if module.source.input[outer_match_idx..].starts_with(outer_match.as_bytes()) { break; @@ -702,7 +704,7 @@ impl<'a> FunctionTester<'a> { // Assuming the function is not polymorphic let definition_id = self.def.this; let func_type = [ConcreteTypePart::Function(definition_id, 0)]; - let mono_index = self.ctx.types.get_procedure_monomorph_type_id(&definition_id.upcast(), &func_type).unwrap(); + let mono_index = self.ctx.types.get_monomorph_type_id(&definition_id.upcast(), &func_type).unwrap(); let mut prompt = Prompt::new(&self.ctx.types, &self.ctx.heap, definition_id, mono_index, ValueGroup::new_stack(Vec::new())); let mut call_context = FakeRunContext{}; @@ -818,7 +820,7 @@ fn get_procedure_monomorph<'a>(heap: &Heap, types: &'a TypeTable, definition_id: [ConcreteTypePart::Component(ast_definition.this, 0)] }; - let mono_index = types.get_procedure_monomorph_type_id(&definition_id, &func_type).unwrap(); + let mono_index = types.get_monomorph_type_id(&definition_id, &func_type).unwrap(); let mono_data = types.get_monomorph(mono_index).variant.as_procedure(); mono_data