Skip to content

Comptime lookups go through Sema's visibility gate (#2248) - #2254

Merged
ehartford merged 1 commit into
mainfrom
ungated-lookups
Oct 7, 2026
Merged

ehartford merged 1 commit into
mainfrom
ungated-lookups

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

See the commit. The evaluator found module lets and types by name, bypassing the gate; now it asks Sema. Fixtures under test/compile_errors/err_2248_*; compile-error suite 1713 ok and comptime set 42 ok on stage1. Gate and battery to follow.

…lure names its cause (#2248)

The second half of #2248, found with the three-spelling matrix and
`explain:visible`: the gate said verdict 0 for a transitive module's
`HIDDEN`, a runtime use was refused, and `comptime match HIDDEN` printed a
value — on every compiler generation. The evaluator did not ask the gate:

- ComptimeEval.find_module_let_decl scanned every module's `let` by name;
  eval_ident and lookup_value now refuse a declaration
  decl_node_visible_from_current refuses, with the runtime use's message
  (`symbol 'X' is not visible from this module`, or the §18.1 import
  fix-it for a std name).
- static_type_expr and eval_field_access read the flat named_types table;
  they use lookup_named_type_visible, as an annotation does.
- A type some module declares and this one cannot see, used as a comptime
  receiver, names the type instead of "runtime value is not available".
- ct_eval_truthy keeps the evaluator's reason (Sema.comptime_truthy_error)
  and select_comptime_if_branch reports it instead of "comptime if
  condition is not comptime-evaluable".
- resolve_type_level_arg_expr reports a `pub` type an unimported module
  declares; it was silent unless the type was private or std.

On stage1, where std.os is loaded only through a corpus, the original
#2248 programs now refuse exactly as the release does (`'Target' requires
an explicit import (§18.1); add: use std.os.Target`); through
`use std.libc` they resolve on both (§18.2 tier 5, interim).

Fixtures: test/compile_errors/err_2248_comptime_let_not_transitive.w,
err_2248_comptime_type_not_transitive.w over lib/issue2248. Evidence:
compile-error suite 1713 files ok, comptime behavior set 42 files ok, on
the rebuilt stage1. Route recorded in deep-debugging-tools.md.

Also: two redundant `unsafe` prefixes and one redundant block inside
`unsafe fn` in std.crypto (the check's own warnings).
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on f599137 (tools/battery.w: gate 63s, uat 28s, battery-checks 783s; status.txt has no RED). Main moved only by docs-only merges since the branch point.

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.

1 participant