casey / just

🤖 Just a command runner
https://just.systems
Creative Commons Zero v1.0 Universal
20.23k stars 450 forks source link

Bug in redefinition compile error reporting #2350

Open marcaddeo opened 1 week ago

marcaddeo commented 1 week ago

While working on #2344 I noticed that the error reporting for redefinition compile errors was not properly swapping types in the messaging when the redefinition is between two types.

Examples:

Aliases

foo:
  echo foo

alias foo := bar

bar:
  echo bar
error: Alias `foo` defined on line 1 is redefined as a recipe on line 4
 ——▶ just-test:4:7
  │
4 │ alias foo := bar
  │       ^^^

Modules

foo:
  echo foo

mod foo "foo.just"
error: Module `foo` defined on line 1 is redefined as a recipe on line 4
 ——▶ just-test:4:5
  │
4 │ mod foo "foo.just"
  │     ^^^

Should I pull the relevant code changes from #2344 and put a new PR in addressing the bug?

casey commented 1 week ago

Thanks for the report!

Should I pull the relevant code changes from https://github.com/casey/just/pull/2344 and put a new PR in addressing the bug?

Yes, that would be awesome!