Merge remote-tracking branch 'origin/main' into feature/sc-479/update-encodings-to-make-use-of-hvmc-n-ary

This commit is contained in:
Nicolas Abril 2024-03-01 22:10:17 +01:00
commit c85d01a817
5 changed files with 26 additions and 4 deletions

View File

@ -37,4 +37,4 @@ stdext = "0.3.1"
walkdir = "2.3.3"
[profile.test]
opt-level = 2
opt-level = 2

View File

@ -69,7 +69,7 @@ impl Info {
pub fn display(&self, verbose: bool) -> impl Display + '_ {
DisplayFn(move |f| {
write!(f, "{}", self.errs.iter().map(|err| err.display(verbose)).join("\n"))?;
writeln!(f, "{}", self.errs.iter().map(|err| err.display(verbose)).join("\n"))?;
for (def_name, errs) in &self.errs_with_def {
writeln!(f, "In definition '{def_name}':")?;

View File

@ -1,4 +1,6 @@
use std::{collections::HashMap, fmt::Display};
use std::fmt::Display;
use indexmap::IndexMap;
use crate::term::{Ctx, Name};
@ -14,7 +16,7 @@ impl Display for TopLevelErr {
impl Ctx<'_> {
/// Checks if exists shared names from definitions, adts and constructors.
pub fn check_shared_names(&mut self) {
let mut checked = HashMap::<&Name, usize>::new();
let mut checked = IndexMap::<&Name, usize>::new();
for adt_name in self.book.adts.keys() {
*checked.entry(adt_name).or_default() += 1;

View File

@ -0,0 +1,9 @@
data A = (A)
data B = (B)
Foo (C) = *
Foo (D) = *
Foo2 (E) = *
Main = *

View File

@ -0,0 +1,11 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/compile_file/error_messages.hvm
---
Duplicated top-level name 'A'.
Duplicated top-level name 'B'.
In definition 'Foo':
Unbound constructor 'C'.
Unbound constructor 'D'.
In definition 'Foo2':
Unbound constructor 'E'.