Repository navigation
Comptime lookups go through Sema's visibility gate (#2248) - #2254
Merged
Merged
Conversation
…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).
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.