Skip to content

Commit 129333a

Browse files
authored
Fix scope lookup for nested submodules (#2820)
1 parent a5c3286 commit 129333a

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/recipe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl<'src, D> Recipe<'src, D> {
5959

6060
pub(crate) fn module_path(&self) -> String {
6161
let mut path = self.namepath.to_string();
62-
path.truncate(path.find("::").unwrap_or_default());
62+
path.truncate(path.rfind("::").unwrap_or_default());
6363
path
6464
}
6565

tests/scope.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,22 @@ fn aliases_in_submodules_run_with_submodule_scope() {
3232
.stderr("echo X X\n")
3333
.run();
3434
}
35+
36+
#[test]
37+
fn dependencies_in_nested_submodules_run_with_submodule_scope() {
38+
Test::new()
39+
.write(
40+
"b.just",
41+
"
42+
x := 'y'
43+
44+
foo:
45+
@echo {{ x }}
46+
",
47+
)
48+
.write("a.just", "mod b")
49+
.stdout("y\n")
50+
.justfile("mod a")
51+
.args(["a", "b", "foo"])
52+
.run();
53+
}

0 commit comments

Comments
 (0)