scope module globals; report one error per unknown method#276
Merged
Conversation
the two remaining filed checker gaps, closed together. module visibility: the shared global scope let any module's names resolve from any other module — checks passed, emission died later with "unknown load source". every binding now carries the module that defined it, and an identifier defined only by foreign modules is an error unless the current module from-imports the name. visibility asks whether any binding of the name is builtin or local, not which binding wins the lookup — a builtin like sqrt is re-registered by std.math, and the later registration must not shadow the builtin's standing. the first run of the enforcement caught eighteen latent violations inside the emitter itself: lookup_type_id used seventeen times and ir_result_field_kind once, all riding the leak. their imports are now explicit. double reporting: a method table that recognizes a method and reports a specific error returned TID_ERR, and the dispatch tail stacked a generic "no method" on top. the tail now skips its report when an error already sits at the same position. an earlier attempt stopped dispatch on TID_ERR instead and broke seven suites — the fallthrough is load-bearing for element types in generic bodies, so dispatch semantics stay untouched and only the duplicate report goes.
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.
summary
the two remaining filed checker gaps, one PR:
sqrtcase). first run caught 18 latent violations in the emitter itself (lookup_type_id×17,ir_result_field_kind), now explicitly imported.Set has no method 'insert' — use add) no longer get a generic "no method" stacked on top; the tail dedupes by position. an attempt to stop dispatch on TID_ERR instead broke seven suites — the fallthrough is load-bearing for generic-body element types — so dispatch semantics are untouched.what was tested
full suite green (all four golden checks), fixed point byte-identical, seed refreshed, fmt gates clean; set.insert reports exactly one E209; stdlib_import (builtin-shadow case) and bytes_io both pass; the compiler compiles itself under its own new visibility rule.