aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/repl_characterization/data/stack_vars.test
blob: c9296eeaa1063d3fd4f8cf6ea3f5aa8b31f4379b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
@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
  «none»:0
  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
  «none»:0
  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 calling the 'trace' builtin
           at $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"; }

         … while calling the 'break' builtin
           at $TEST_DATA/stack_vars.nix:3:23:
              2|   a = builtins.trace "before inner break" (
              3|     let meow' = 3; in builtins.break { msg = "hello"; }
               |                       ^
              4|   );

         error: breakpoint reached