Open ElvishJerricco opened 2 years ago
This is not limited to if
. It also affect builtins.toJSON
, for example:
❯ cat test.nix
builtins.toJSON { x = builtins.break {}; }
❯ nix run github:nixos/nix/2.12-maintenance -- eval --debugger --file ./test.nix
info: breakpoint reached
at …/test.nix:1:16:
1| builtins.toJSON { x = builtins.break {}; }
| ^
Starting REPL to allow you to inspect the current state of the evaluator.
Welcome to Nix 2.12.1. Type :? for help.
nix-repl> :c
error: cannot convert a thunk to JSON
at …/test.nix:1:12:
1| builtins.toJSON { x = builtins.break {}; }
| ^
Starting REPL to allow you to inspect the current state of the evaluator.
Welcome to Nix 2.12.1. Type :? for help.
nix-repl> :c
error: cannot convert a thunk to JSON
at …/test.nix:1:12:
1| builtins.toJSON { x = builtins.break {}; }
| ^
(use '--show-trace' to show detailed location information)
This snippet evaluates fine (1
instead of {}
):
builtins.toJSON { x = builtins.break 1; }
Describe the bug
When trying to use
--debugger
andbuiltins.break
, I sometimes geterror: value is a thunk while a Boolean was expected
, causing evaluation to fail when it wouldn't have withoutbuiltins.break
.Steps To Reproduce
Expected behavior
Should have evaluated to
"has value"
without errors.nix-env --version
outputnix-env (Nix) 2.10.3