From 956b12d372c56ad77d21960f6ab48bb1a5837e20 Mon Sep 17 00:00:00 2001 From: Sofia R Date: Mon, 8 May 2023 10:54:43 -0300 Subject: [PATCH] feat: added '/' with empty right side --- Cargo.lock | 13 ++++++++++--- crates/kind-pass/src/expand/uses.rs | 4 ++++ crates/kind-pass/src/unbound/mod.rs | 6 +++++- crates/kind-tests/tests/mod.rs | 14 +++++++------- crates/kind-tree/src/symbol.rs | 4 ++++ 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a1d557d6..0e7bf079 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -500,9 +500,9 @@ checksum = "809e18805660d7b6b2e2b9f316a5099521b5998d5cba4dda11b5157a21aaef03" [[package]] name = "hvm" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35672d6ee046e8ebd6373a48aad5b926b4920cee27cb4f45e74643e7388c7a9e" +checksum = "c7b8fc0ca6cceaffa4d4587bea27db3c6126771d1dfd0b8dce0504e6d4833b7c" dependencies = [ "HOPA", "backtrace", @@ -717,6 +717,7 @@ dependencies = [ "fxhash", "kind-span", "pathdiff", + "refl", "termsize", "unicode-width", "yansi", @@ -782,7 +783,7 @@ dependencies = [ [[package]] name = "kind2" -version = "0.3.9" +version = "0.3.10" dependencies = [ "anyhow", "clap 4.0.29", @@ -1309,6 +1310,12 @@ dependencies = [ "redox_syscall", ] +[[package]] +name = "refl" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5fe2c8ee36d7d4f60a0574c7116a0614e3bf48bfa249062698b228bddee5026" + [[package]] name = "rustc-demangle" version = "0.1.21" diff --git a/crates/kind-pass/src/expand/uses.rs b/crates/kind-pass/src/expand/uses.rs index df2eb41c..1318d5f8 100644 --- a/crates/kind-pass/src/expand/uses.rs +++ b/crates/kind-pass/src/expand/uses.rs @@ -33,6 +33,10 @@ impl Visitor for Expand { } }; match &ident.get_aux() { + Some(post) if post.is_empty() => { + ident.change_root(alias.to_string()); + ident.reset_aux() + } Some(post) => { ident.change_root(format!("{}.{}", alias, post)); ident.reset_aux() diff --git a/crates/kind-pass/src/unbound/mod.rs b/crates/kind-pass/src/unbound/mod.rs index bcee9f39..f621f6f1 100644 --- a/crates/kind-pass/src/unbound/mod.rs +++ b/crates/kind-pass/src/unbound/mod.rs @@ -169,7 +169,11 @@ impl Visitor for UnboundCollector { } fn visit_qualified_ident(&mut self, ident: &mut QualifiedIdent) { - debug_assert!(ident.get_aux().is_none()); + + if !ident.get_aux().is_none() { + panic!("problem with 'use' desugaring") + } + if !self.top_level_defs.contains_key(&ident.get_root()) { let entry = self.unbound_top_level.entry(ident.get_root()).or_default(); entry.insert(ident.clone()); diff --git a/crates/kind-tests/tests/mod.rs b/crates/kind-tests/tests/mod.rs index 4537bbf9..e33a7fa6 100644 --- a/crates/kind-tests/tests/mod.rs +++ b/crates/kind-tests/tests/mod.rs @@ -85,7 +85,7 @@ fn test_checker_issues() -> Result<(), Error> { } #[test] -#[timeout(15000)] +#[timeout(30000)] fn test_run() -> Result<(), Error> { test_kind2(Path::new("./suite/run"), |path, session| { let entrypoints = vec!["Main".to_string()]; @@ -100,7 +100,7 @@ fn test_run() -> Result<(), Error> { } #[test] -#[timeout(15000)] +#[timeout(30000)] fn test_eval() -> Result<(), Error> { test_kind2(Path::new("./suite/eval"), |path, session| { let check = driver::desugar_book(session, path) @@ -112,7 +112,7 @@ fn test_eval() -> Result<(), Error> { } #[test] -#[timeout(15000)] +#[timeout(30000)] fn test_eval_issues() -> Result<(), Error> { test_kind2(Path::new("./suite/issues/eval"), |path, session| { let check = driver::desugar_book(session, path) @@ -124,7 +124,7 @@ fn test_eval_issues() -> Result<(), Error> { } #[test] -#[timeout(15000)] +#[timeout(30000)] fn test_run_issues() -> Result<(), Error> { test_kind2(Path::new("./suite/issues/run"), |path, session| { let entrypoints = vec!["Main".to_string()]; @@ -139,7 +139,7 @@ fn test_run_issues() -> Result<(), Error> { } #[test] -#[timeout(15000)] +#[timeout(30000)] fn test_kdl() -> Result<(), Error> { test_kind2(Path::new("./suite/kdl"), |path, session| { let entrypoints = vec!["Main".to_string()]; @@ -150,7 +150,7 @@ fn test_kdl() -> Result<(), Error> { } #[test] -#[timeout(15000)] +#[timeout(30000)] fn test_erasure() -> Result<(), Error> { test_kind2(Path::new("./suite/erasure"), |path, session| { let entrypoints = vec!["Main".to_string()]; @@ -161,7 +161,7 @@ fn test_erasure() -> Result<(), Error> { } #[test] -#[timeout(15000)] +#[timeout(30000)] fn test_coverage() -> Result<(), Error> { test_kind2(Path::new("./suite/issues/coverage"), |path, session| { let entrypoints = vec!["Main".to_string()]; diff --git a/crates/kind-tree/src/symbol.rs b/crates/kind-tree/src/symbol.rs index 45a02a71..fd052e21 100644 --- a/crates/kind-tree/src/symbol.rs +++ b/crates/kind-tree/src/symbol.rs @@ -21,6 +21,10 @@ impl Symbol { data: str, } } + + pub fn is_empty(&self) -> bool { + self.data.is_empty() + } } impl PartialEq for Symbol {