Skip to content

#3187: a callee's environment keeps the script marks of the bindings it inherits - #3188

Merged
ehartford merged 1 commit into
i3170from
i3187
Nov 9, 2026
Merged

ehartford merged 1 commit into
i3170from
i3187

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Fixes #3187. A program with a top-level var i (a script global) and a call of enumerate() was refused with 'shadowing is not allowed' pointing into std: enter_callee_lexical_env copied the helper's injected script bindings into the generic instance's environment without their D184 marks. The marks now travel with the bindings. Fixtures: behav_3187_script_global_beside_enumerate, behav_3187_script_global_beside_module_generic (+ lib/pair_3187.w). Dev stage1: both fixtures and all 26 shadowing/D184 fixtures green. Gate and battery to follow.

@ehartford
ehartford changed the base branch from main to i3170 November 9, 2026 06:42
@ehartford
ehartford added this pull request to stack #3190 November 9, 2026 06:42
…it inherits, so another module's local never shadows a program's top-level binding

A script's top-level binding is injected into its helpers (D184) and
marked in script_capture_indices, which lets a helper's own local take
the name. When a helper's call triggered a generic instance check,
enter_callee_lexical_env copied the helper's module-scope bindings (the
injected ones among them) into the callee's environment and reset the
marks, so std's `let i` in enumerate's `next` was refused as shadowing
a program's `var i`: any program with a top-level `var i` and a call of
enumerate() failed, the error pointing into the standard library (the
pinned seed too). The marks now travel with the copied bindings.

Fixtures: behav_3187_script_global_beside_enumerate (std) and
behav_3187_script_global_beside_module_generic (a user module's generic
method, lib/pair_3187.w).
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on the stack tip 793be7e (with run tools/battery.w in ~/.local/with-staging/ishadow, wall 887 s, gate included; out/battery/status.txt: GREEN BATTERY_DONE). The first run was red on pub-lint-check only (a pub written for a test), fixed in the #3170 commit. Covers #3189 below it.

@ehartford
ehartford marked this pull request as ready for review November 9, 2026 07:13
@ehartford
ehartford merged commit a202ed1 into main Nov 9, 2026
@ehartford
ehartford deleted the i3187 branch November 9, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant