oils-for-unix / oils

Oils is our upgrade path from bash to a better language and runtime. It's also for Python and JavaScript users who avoid shell!
http://www.oilshell.org/
Other
2.85k stars 159 forks source link

Code location from previous command failure is sometimes retained #2129

Open quexxon opened 4 days ago

quexxon commented 4 days ago

In this example, calling p initially shows the expected code location in the echo error, but after calling echo erroneously at the top-level, the code location from the last failed top-level execution is displayed thereafter when calling p.

ysh-0.24.0$ proc p (...args) {
>   echo $args # introducing a bug so this fails
> }

ysh-0.24.0$ p 1 2 3
    echo $args # introducing a bug so this fails
    ^~~~
[ interactive ]:2: fatal: Word eval got a List, which can't be stringified (OILS-ERR-203)

ysh-0.24.0$ echo $[{}]
  echo $[{}]
       ^~
[ interactive ]:5: fatal: Expr sub expected one of (Null Bool Int Float Str Eggex), got Dict

ysh-0.24.0$ p 1 2 3
  echo $[{}]
       ^~
[ interactive ]:5: fatal: Word eval got a List, which can't be stringified (OILS-ERR-203)
andychu commented 4 days ago

Ah OK, I think this is because we have a loc.Missing combined a failure to set the "fallback" location

I will look at this, thank you!