Skip to content

Bindings escape proof_subshell #2243

@sauclovian-g

Description

@sauclovian-g

Create foo.saw containing the following:

enable_experimental;

let foo () = do {
   prove_print do {
      proof_subshell ();
   } {{ True }};
};

let bar () = do {
   print {{ quack }};
};

foo ();
bar ();

Run it in saw, and when it starts the interactive proof subshell, do the following:

proof (1)> let quack = {{ 3 : [8] }}
proof (1)> trivial
proof (0)> ^D

It will then print

[22:42:44.165] 3

instead of failing on the theoretically unbound variable quack.

Note that print quack rather than print {{ quack }} fails, but that's because of saw's phase distinctions and not because the interpreter isn't also messing up the saw-script-level binding environment. If you call foo before declaring bar, then quack leaks into the environment before bar is typechecked and you can successfully do print quack as well.

I discovered this while investigating #2242, but it isn't (directly) related to it.

Metadata

Metadata

Assignees

Labels

needs testIssues for which we should add a regression testsubsystem: saw-scriptIssues related to the SAWScript language and/or its interpretation and executiontech debtIssues that document or involve technical debttype: bugIssues reporting bugs or unexpected/unwanted behavior

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions