diff --git a/compiler/qsc_data_structures/src/namespaces.rs b/compiler/qsc_data_structures/src/namespaces.rs index 1ff7c5c253..7ac215fde1 100644 --- a/compiler/qsc_data_structures/src/namespaces.rs +++ b/compiler/qsc_data_structures/src/namespaces.rs @@ -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 {}) {{", @@ -360,17 +360,16 @@ impl NamespaceTreeNode { Into::::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 } } diff --git a/compiler/qsc_frontend/src/resolve/tests.rs b/compiler/qsc_frontend/src/resolve/tests.rs index 08f8cedf6a..403240840d 100644 --- a/compiler/qsc_frontend/src/resolve/tests.rs +++ b/compiler/qsc_frontend/src/resolve/tests.rs @@ -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(); + } + } + "#]], + ); +}