Files
lix/tests/functional/repl_characterization/data/stack_vars.test
T
blokyk 66d702d28d libexpr/primops: make break force its argument
previously, `builtins.break` didn't force its argument, resulting in
a value wrapped with `break` being opaque to most builtins if not
also wrapped with `seq`. see [lix-project/lix#1165] for more details
on what this can break.

this tiny fix just adds a call to `forceValue` inside `prim_break`,
but unfortunately this "breaks" a few existing tests because it
changes the call stack; those tests' golden outputs have been adjusted
without modifying their intended purpose.

Fixes #1165

[lix-project/lix#1165]: https://git.lix.systems/lix-project/lix/issues/1165

Change-Id: I5fe4ee3ff28b38aaf924125b8978130812e58fef
2026-03-21 18:38:43 +01:00

109 lines
2.9 KiB
Plaintext

@args --debugger
trace: before outer break
info: breakpoint reached
Here we are in the outer break and the let of "meow". st should show meow there
as it is in scope.
nix-repl> :st
0: error: breakpoint reached
$TEST_DATA/stack_vars.nix:6:22
5| b = builtins.trace "before outer break" (
6| let meow = 2; in builtins.break a
| ^
7| );
Env level 0
static: meow
Env level 1
static: a b
Env level 2
abort baseNameOf break builtins derivation derivationStrict dirOf false fetchGit fetchMercurial fetchTarball fetchTree fromTOML import isNull map null placeholder removeAttrs scopedImport throw toString true
nix-repl> meow
2
If we :st past the frame in the backtrace with the meow in it, the meow should not be there.
nix-repl> :st 3
3: while calling a function
$TEST_DATA/stack_vars.nix:5:7
4| );
5| b = builtins.trace "before outer break" (
| ^
6| let meow = 2; in builtins.break a
Env level 0
static: a b
Env level 1
abort baseNameOf break builtins derivation derivationStrict dirOf false fetchGit fetchMercurial fetchTarball fetchTree fromTOML import isNull map null placeholder removeAttrs scopedImport throw toString true
nix-repl> :c
trace: before inner break
info: breakpoint reached
nix-repl> :st
0: error: breakpoint reached
$TEST_DATA/stack_vars.nix:3:23
2| a = builtins.trace "before inner break" (
3| let meow' = 3; in builtins.break { msg = "hello"; }
| ^
4| );
Env level 0
static: meow'
Env level 1
static: a b
Env level 2
abort baseNameOf break builtins derivation derivationStrict dirOf false fetchGit fetchMercurial fetchTarball fetchTree fromTOML import isNull map null placeholder removeAttrs scopedImport throw toString true
nix-repl> meow'
3
nix-repl> :st 3
3: while calling a function
$TEST_DATA/stack_vars.nix:2:7
1| let
2| a = builtins.trace "before inner break" (
| ^
3| let meow' = 3; in builtins.break { msg = "hello"; }
Env level 0
static: a b
Env level 1
abort baseNameOf break builtins derivation derivationStrict dirOf false fetchGit fetchMercurial fetchTarball fetchTree fromTOML import isNull map null placeholder removeAttrs scopedImport throw toString true
nix-repl> :quit
error:
… while evaluating the file '$TEST_DATA/stack_vars.nix':
… while evaluating b
at $TEST_DATA/stack_vars.nix:9:3:
8| in
9| b
| ^
10|
… while calling the 'trace' builtin
at $TEST_DATA/stack_vars.nix:5:7:
4| );
5| b = builtins.trace "before outer break" (
| ^
6| let meow = 2; in builtins.break a
(stack trace truncated; use '--show-trace' to show the full trace)
error: breakpoint reached