-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
Is your feature request related to a problem? Please describe.
When using the update operator with wrong types, there is no error position pointer in the output of --show-trace
Evaluating the following nix expression:
let
s = "hello";
func =
arg1: arg2:
let
# some other invalid statements errors
a = s + 1;
b = s ++ 1;
c = [] // s;
in
# invalid statement triggering the error
{} // s;
in
func 1 2... the printed error looks like this:
error: value is "hello" while a set was expected
… while evaluating 'func'
at /home/grmpf/synced/projects/github/dream2nix/.temp/test.nix:6:11:
5| func =
6| arg1: arg2:
| ^
7| let
… from call site
at /home/grmpf/synced/projects/github/dream2nix/.temp/test.nix:17:3:
16| in
17| func 1 2
| ^
… while evaluating the file ...
The position pointer points at line 6, while the actual error happens in line 14.
This problem is specific to the // operator. When evaluating a similar invalid statement with the ++ operator, the error position is shown correctly:
error: value is a string while a list was expected
at /home/grmpf/synced/projects/github/dream2nix/.temp/test.nix:14:7:
13| # invalid statement triggering the error
14| [] ++ s;
| ^
15|
… while evaluating 'func'
at /home/grmpf/synced/projects/github/dream2nix/.temp/test.nix:6:11:
5| func =
6| arg1: arg2:
| ^
7| let
… from call site
at /home/grmpf/synced/projects/github/dream2nix/.temp/test.nix:17:3:
16| in
17| func 1 2
| ^
… while evaluating the file
Describe the solution you'd like
Print a stack trace showing the correct position of the error, similar to how it's done with ++ (see last example).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels