Improve messages for alias error messages (#500)

This commit is contained in:
Casey Rodarmor 2019-10-19 20:00:41 -07:00 committed by GitHub
parent 49ab423592
commit 83f40aa805
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -22,9 +22,10 @@ impl<'a> Display for CompilationError<'a> {
AliasShadowsRecipe { alias, recipe_line } => { AliasShadowsRecipe { alias, recipe_line } => {
writeln!( writeln!(
f, f,
"Alias `{}` defined on `{}` shadows recipe defined on `{}`", "Alias `{}` defined on line {} shadows recipe `{}` defined on line {}",
alias, alias,
self.line.ordinal(), self.line.ordinal(),
alias,
recipe_line.ordinal(), recipe_line.ordinal(),
)?; )?;
} }
@ -85,7 +86,7 @@ impl<'a> Display for CompilationError<'a> {
DuplicateAlias { alias, first } => { DuplicateAlias { alias, first } => {
writeln!( writeln!(
f, f,
"Alias `{}` first defined on line `{}` is redefined on line `{}`", "Alias `{}` first defined on line {} is redefined on line {}",
alias, alias,
first.ordinal(), first.ordinal(),
self.line.ordinal(), self.line.ordinal(),

View File

@ -237,7 +237,7 @@ integration_test! {
name: duplicate_alias, name: duplicate_alias,
justfile: "alias foo := bar\nalias foo := baz\n", justfile: "alias foo := bar\nalias foo := baz\n",
stderr: " 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 2 | alias foo := baz
| ^^^ | ^^^
@ -261,7 +261,7 @@ integration_test! {
name: alias_shadows_recipe, name: alias_shadows_recipe,
justfile: "bar:\n echo bar\nalias foo := bar\nfoo:\n echo foo", justfile: "bar:\n echo bar\nalias foo := bar\nfoo:\n echo foo",
stderr: " 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 3 | alias foo := bar
| ^^^ | ^^^