mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Merge pull request #9753 from 9999years/print-value-on-type-error
Print the value in `value is X while a Y is expected` error
This commit is contained in:
commit
5f72a97092
19 changed files with 227 additions and 136 deletions
23
doc/manual/rl-next/print-value-in-type-error.md
Normal file
23
doc/manual/rl-next/print-value-in-type-error.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
synopsis: Type errors include the failing value
|
||||
issues: #561
|
||||
prs: #9753
|
||||
---
|
||||
|
||||
In errors like `value is an integer while a list was expected`, the message now
|
||||
includes the failing value.
|
||||
|
||||
Before:
|
||||
|
||||
```
|
||||
error: value is a set while a string was expected
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
```
|
||||
error: expected a string but found a set: { ghc810 = «thunk»;
|
||||
ghc8102Binary = «thunk»; ghc8107 = «thunk»; ghc8107Binary = «thunk»;
|
||||
ghc865Binary = «thunk»; ghc90 = «thunk»; ghc902 = «thunk»; ghc92 = «thunk»;
|
||||
ghc924Binary = «thunk»; ghc925 = «thunk»; «17 attributes elided»}
|
||||
```
|
|
@ -38,5 +38,5 @@ error:
|
|||
| ^
|
||||
5|
|
||||
|
||||
error: value is a set while a string was expected
|
||||
error: expected a string but found a set
|
||||
```
|
||||
|
|
|
@ -8,7 +8,7 @@ prs: 9658
|
|||
Previously an incorrect `with` expression would report no position at all, making it hard to determine where the error originated:
|
||||
|
||||
```
|
||||
nix-repl> with 1; a
|
||||
nix-repl> with 1; a
|
||||
error:
|
||||
… <borked>
|
||||
|
||||
|
@ -27,5 +27,5 @@ error:
|
|||
1| with 1; a
|
||||
| ^
|
||||
|
||||
error: value is an integer while a set was expected
|
||||
error: expected a set but found an integer
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue