mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 16:33:37 +01:00
Auto-hide aliases to prevent recursion (#4487)
This commit is contained in:
parent
df07e8e410
commit
e763a8dcef
@ -851,7 +851,10 @@ pub fn parse_call(
|
||||
new_spans.extend(&spans[(pos + 1)..]);
|
||||
}
|
||||
|
||||
working_set.enter_scope();
|
||||
working_set.hide_alias(&name);
|
||||
let (mut result, err) = parse_expression(working_set, &new_spans, false);
|
||||
working_set.exit_scope();
|
||||
|
||||
result.replace_span(working_set, expansion_span, orig_span);
|
||||
|
||||
|
@ -33,6 +33,11 @@ fn alias_2_multi_word() -> TestResult {
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn alias_recursion() -> TestResult {
|
||||
run_test_contains(r#"alias ls = (ls | sort-by type name -i); ls"#, " ")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn block_param1() -> TestResult {
|
||||
run_test("[3] | each { $it + 10 } | get 0", "13")
|
||||
|
Loading…
Reference in New Issue
Block a user