feat: added '/' with empty right side

This commit is contained in:
Sofia R 2023-05-08 10:54:43 -03:00
parent 9a44360bbe
commit 956b12d372
5 changed files with 30 additions and 11 deletions

13
Cargo.lock generated
View File

@ -500,9 +500,9 @@ checksum = "809e18805660d7b6b2e2b9f316a5099521b5998d5cba4dda11b5157a21aaef03"
[[package]] [[package]]
name = "hvm" name = "hvm"
version = "1.0.6" version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35672d6ee046e8ebd6373a48aad5b926b4920cee27cb4f45e74643e7388c7a9e" checksum = "c7b8fc0ca6cceaffa4d4587bea27db3c6126771d1dfd0b8dce0504e6d4833b7c"
dependencies = [ dependencies = [
"HOPA", "HOPA",
"backtrace", "backtrace",
@ -717,6 +717,7 @@ dependencies = [
"fxhash", "fxhash",
"kind-span", "kind-span",
"pathdiff", "pathdiff",
"refl",
"termsize", "termsize",
"unicode-width", "unicode-width",
"yansi", "yansi",
@ -782,7 +783,7 @@ dependencies = [
[[package]] [[package]]
name = "kind2" name = "kind2"
version = "0.3.9" version = "0.3.10"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap 4.0.29", "clap 4.0.29",
@ -1309,6 +1310,12 @@ dependencies = [
"redox_syscall", "redox_syscall",
] ]
[[package]]
name = "refl"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5fe2c8ee36d7d4f60a0574c7116a0614e3bf48bfa249062698b228bddee5026"
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.21" version = "0.1.21"

View File

@ -33,6 +33,10 @@ impl Visitor for Expand {
} }
}; };
match &ident.get_aux() { match &ident.get_aux() {
Some(post) if post.is_empty() => {
ident.change_root(alias.to_string());
ident.reset_aux()
}
Some(post) => { Some(post) => {
ident.change_root(format!("{}.{}", alias, post)); ident.change_root(format!("{}.{}", alias, post));
ident.reset_aux() ident.reset_aux()

View File

@ -169,7 +169,11 @@ impl Visitor for UnboundCollector {
} }
fn visit_qualified_ident(&mut self, ident: &mut QualifiedIdent) { 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()) { if !self.top_level_defs.contains_key(&ident.get_root()) {
let entry = self.unbound_top_level.entry(ident.get_root()).or_default(); let entry = self.unbound_top_level.entry(ident.get_root()).or_default();
entry.insert(ident.clone()); entry.insert(ident.clone());

View File

@ -85,7 +85,7 @@ fn test_checker_issues() -> Result<(), Error> {
} }
#[test] #[test]
#[timeout(15000)] #[timeout(30000)]
fn test_run() -> Result<(), Error> { fn test_run() -> Result<(), Error> {
test_kind2(Path::new("./suite/run"), |path, session| { test_kind2(Path::new("./suite/run"), |path, session| {
let entrypoints = vec!["Main".to_string()]; let entrypoints = vec!["Main".to_string()];
@ -100,7 +100,7 @@ fn test_run() -> Result<(), Error> {
} }
#[test] #[test]
#[timeout(15000)] #[timeout(30000)]
fn test_eval() -> Result<(), Error> { fn test_eval() -> Result<(), Error> {
test_kind2(Path::new("./suite/eval"), |path, session| { test_kind2(Path::new("./suite/eval"), |path, session| {
let check = driver::desugar_book(session, path) let check = driver::desugar_book(session, path)
@ -112,7 +112,7 @@ fn test_eval() -> Result<(), Error> {
} }
#[test] #[test]
#[timeout(15000)] #[timeout(30000)]
fn test_eval_issues() -> Result<(), Error> { fn test_eval_issues() -> Result<(), Error> {
test_kind2(Path::new("./suite/issues/eval"), |path, session| { test_kind2(Path::new("./suite/issues/eval"), |path, session| {
let check = driver::desugar_book(session, path) let check = driver::desugar_book(session, path)
@ -124,7 +124,7 @@ fn test_eval_issues() -> Result<(), Error> {
} }
#[test] #[test]
#[timeout(15000)] #[timeout(30000)]
fn test_run_issues() -> Result<(), Error> { fn test_run_issues() -> Result<(), Error> {
test_kind2(Path::new("./suite/issues/run"), |path, session| { test_kind2(Path::new("./suite/issues/run"), |path, session| {
let entrypoints = vec!["Main".to_string()]; let entrypoints = vec!["Main".to_string()];
@ -139,7 +139,7 @@ fn test_run_issues() -> Result<(), Error> {
} }
#[test] #[test]
#[timeout(15000)] #[timeout(30000)]
fn test_kdl() -> Result<(), Error> { fn test_kdl() -> Result<(), Error> {
test_kind2(Path::new("./suite/kdl"), |path, session| { test_kind2(Path::new("./suite/kdl"), |path, session| {
let entrypoints = vec!["Main".to_string()]; let entrypoints = vec!["Main".to_string()];
@ -150,7 +150,7 @@ fn test_kdl() -> Result<(), Error> {
} }
#[test] #[test]
#[timeout(15000)] #[timeout(30000)]
fn test_erasure() -> Result<(), Error> { fn test_erasure() -> Result<(), Error> {
test_kind2(Path::new("./suite/erasure"), |path, session| { test_kind2(Path::new("./suite/erasure"), |path, session| {
let entrypoints = vec!["Main".to_string()]; let entrypoints = vec!["Main".to_string()];
@ -161,7 +161,7 @@ fn test_erasure() -> Result<(), Error> {
} }
#[test] #[test]
#[timeout(15000)] #[timeout(30000)]
fn test_coverage() -> Result<(), Error> { fn test_coverage() -> Result<(), Error> {
test_kind2(Path::new("./suite/issues/coverage"), |path, session| { test_kind2(Path::new("./suite/issues/coverage"), |path, session| {
let entrypoints = vec!["Main".to_string()]; let entrypoints = vec!["Main".to_string()];

View File

@ -21,6 +21,10 @@ impl Symbol {
data: str, data: str,
} }
} }
pub fn is_empty(&self) -> bool {
self.data.is_empty()
}
} }
impl PartialEq for Symbol { impl PartialEq for Symbol {