Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
sezna committed May 22, 2024
1 parent 0bcd6ef commit 0415cf3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
13 changes: 6 additions & 7 deletions compiler/qsc_data_structures/src/namespaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ impl NamespaceTreeNode {
if self.children.is_empty() {
result.push_str("empty node");
} else {
result.push_str(&format!("\n{} children: [", indentation));
result.push_str(&format!("\n{indentation} children: ["));
for (name, node) in &self.children {
result.push_str(&format!(
"\n{} {}(id {}) {{",
Expand All @@ -360,17 +360,16 @@ impl NamespaceTreeNode {
Into::<usize>::into(node.borrow().id)
));
result.push_str(
&node
.borrow()
node.borrow()
.debug_print(indentation_level + 2, visited_nodes)
.as_str(),
);
result.push_str(",");
result.push(',');
}
result.push_str(&format!("\n{} ]", indentation));
result.push_str(&format!("\n{}", indentation));
result.push_str(&format!("\n{indentation} ]"));
result.push_str(&format!("\n{indentation}"));
}
result.push_str("}");
result.push('}');
result
}
}
36 changes: 36 additions & 0 deletions compiler/qsc_frontend/src/resolve/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3574,3 +3574,39 @@ fn export_direct_cycle() {
"#]],
);
}

#[test]
fn export_namespace_with_alias() {
check(
indoc! {"
namespace Foo.Bar {
operation ApplyX() : Unit {}
}
namespace Main {
export { Foo.Bar as Baz };
}
namespace Test {
open Main.Baz;
operation Main() : Unit {
ApplyX();
Main.Baz.ApplyX();
}
}
"},
&expect![[r#"
namespace namespace8 {
operation item1() : Unit {}
}
namespace namespace9 {
export { namespace8 };
}
namespace namespace10 {
open namespace8;
operation item4() : Unit {
item1();
item1();
}
}
"#]],
);
}

0 comments on commit 0415cf3

Please sign in to comment.