casey / just

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

Confusing error, expected function, but parameter of same name exists #1959

Open Skgland opened 2 months ago

Skgland commented 2 months ago

I would have expected the following to work

t A B="c": (q A ("e" + B) ("f" + B))

q R S T:
    echo {{R}} {{S}} {{T}}
$> just t "p"
error: Call to unknown function `A`
  ——▶ .justfile:21:15
   │
21 │ t A B="c": (q A ("e" + B) ("f" + B))
   │               ^

But it expects A to be a function instead of the Parameter. Adding parenthesis around A, resolves the problem.

t A B="c": (q (A) ("e" + B) ("f" + B))

q R S T:
    echo {{R}} {{S}} {{T}}
$> just t "p"
p ec fc

I am probably missing something why the parenthesis are required, but anyway an improved error message in case a matching parameter exist might be warranted.

$> just --version
just 1.25.2