Skip to content

Sema: a build file's environment read is refused with a pointer to ctx.env_input (#649) - #2727

Merged
ehartford merged 1 commit into
fix-768from
fix-649
Oct 26, 2026
Merged

ehartford merged 1 commit into
fix-768from
fix-649

Conversation

@ehartford

@ehartford ehartford commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

A build file reads the environment as a declared input (§17.1a) through
BuildCtx.env_input or ActionCtx.env_input, which record the value so a
change reruns what read it. The raw spellings are already refused at
comptime and nothing is read silently, but the refusals named only what
is forbidden: env("HOME") was "'env' is not comptime-callable: it
reaches env -> with_getenv_str", and unsafe { with_getenv_str(..) }
was "unsafe is not allowed in comptime". Both now carry the help
"read the variable with ctx.env_input(\"NAME\")...". The two env_input
functions are documented where they are declared, and the stale
build/selfhost.w comment that said no opt-in API exists points at
env_input.

Test: test/behavior/behav_649_build_env_read_names_env_input.w.

Closes #649

…x.env_input (#649)

A build file reads the environment as a declared input (§17.1a) through
BuildCtx.env_input or ActionCtx.env_input, which record the value so a
change reruns what read it. The raw spellings are already refused at
comptime and nothing is read silently, but the refusals named only what
is forbidden: `env("HOME")` was "'env' is not comptime-callable: it
reaches env -> with_getenv_str", and `unsafe { with_getenv_str(..) }`
was "unsafe is not allowed in comptime". Both now carry the help
"read the variable with `ctx.env_input(\"NAME\")`...". The two env_input
functions are documented where they are declared, and the stale
build/selfhost.w comment that said no opt-in API exists points at
env_input.

Test: test/behavior/behav_649_build_env_read_names_env_input.w.
@ehartford
ehartford added this pull request to stack #2730 October 26, 2026 01:51
@ehartford ehartford changed the title fix 649 Sema: a build file's environment read is refused with a pointer to ctx.env_input (#649) Oct 26, 2026
@ehartford
ehartford marked this pull request as ready for review October 26, 2026 02:19
@ehartford
ehartford merged commit 21c4a21 into main Oct 26, 2026
@ehartford
ehartford deleted the fix-649 branch October 26, 2026 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build-action environment inputs: diagnostics, default effects, and docs

1 participant