Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/sc-479/update…
Browse files Browse the repository at this point in the history
…-encodings-to-make-use-of-hvmc-n-ary
  • Loading branch information
developedby committed Mar 1, 2024
2 parents 54af9f1 + 3d7c4e8 commit c85d01a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ stdext = "0.3.1"
walkdir = "2.3.3"

[profile.test]
opt-level = 2
opt-level = 2
2 changes: 1 addition & 1 deletion src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}':")?;
Expand Down
6 changes: 4 additions & 2 deletions src/term/check/shared_names.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use std::{collections::HashMap, fmt::Display};
use std::fmt::Display;

use indexmap::IndexMap;

use crate::term::{Ctx, Name};

Expand All @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions tests/golden_tests/compile_file/error_messages.hvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
data A = (A)
data B = (B)

Foo (C) = *
Foo (D) = *

Foo2 (E) = *

Main = *
11 changes: 11 additions & 0 deletions tests/snapshots/compile_file__error_messages.hvm.snap
Original file line number Diff line number Diff line change
@@ -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'.

0 comments on commit c85d01a

Please sign in to comment.