Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve alias-related error messages #500

Merged
merged 1 commit into from
Oct 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/compilation_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ impl<'a> Display for CompilationError<'a> {
AliasShadowsRecipe { alias, recipe_line } => {
writeln!(
f,
"Alias `{}` defined on `{}` shadows recipe defined on `{}`",
"Alias `{}` defined on line {} shadows recipe `{}` defined on line {}",
alias,
self.line.ordinal(),
alias,
recipe_line.ordinal(),
)?;
}
Expand Down Expand Up @@ -85,7 +86,7 @@ impl<'a> Display for CompilationError<'a> {
DuplicateAlias { alias, first } => {
writeln!(
f,
"Alias `{}` first defined on line `{}` is redefined on line `{}`",
"Alias `{}` first defined on line {} is redefined on line {}",
alias,
first.ordinal(),
self.line.ordinal(),
Expand Down
4 changes: 2 additions & 2 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ integration_test! {
name: duplicate_alias,
justfile: "alias foo := bar\nalias foo := baz\n",
stderr: "
error: Alias `foo` first defined on line `1` is redefined on line `2`
error: Alias `foo` first defined on line 1 is redefined on line 2
|
2 | alias foo := baz
| ^^^
Expand All @@ -261,7 +261,7 @@ integration_test! {
name: alias_shadows_recipe,
justfile: "bar:\n echo bar\nalias foo := bar\nfoo:\n echo foo",
stderr: "
error: Alias `foo` defined on `3` shadows recipe defined on `4`
error: Alias `foo` defined on line 3 shadows recipe `foo` defined on line 4
|
3 | alias foo := bar
| ^^^
Expand Down