diff --git a/src/parser.rs b/src/parser.rs index ffbd1a888a..91ce8fc8c6 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -814,6 +814,7 @@ impl<'a> ParserWorkingSet<'a> { if expand_aliases { if let Some(expansion) = self.find_alias(name) { + let orig_span = spans[pos]; //let mut spans = spans.to_vec(); let mut new_spans: Vec = vec![]; new_spans.extend(&spans[0..pos]); @@ -822,7 +823,25 @@ impl<'a> ParserWorkingSet<'a> { new_spans.extend(&spans[(pos + 1)..]); } - return self.parse_call(&new_spans, false); + let (result, err) = self.parse_call(&new_spans, false); + + let expression = match result { + Expression { + expr: Expr::Call(mut call), + span, + ty, + } => { + call.head = orig_span; + Expression { + expr: Expr::Call(call), + span, + ty, + } + } + x => x, + }; + + return (expression, err); } }