iter 23.1.3 fixup: clarify imports-fallback anchor + comment on env.imports vs env.module_imports duplication
This commit is contained in:
@@ -1298,9 +1298,14 @@ fn check_in_workspace(
|
|||||||
import_map.insert(key, imp.module.clone());
|
import_map.insert(key, imp.module.clone());
|
||||||
}
|
}
|
||||||
// Iter 23.1: the prelude module is implicitly imported into
|
// Iter 23.1: the prelude module is implicitly imported into
|
||||||
// every non-prelude module's body-check env. Mirrors the
|
// every non-prelude module's body-check env. The wiring here
|
||||||
// workspace-flat overlay in `build_check_env`. The prelude
|
// populates `env.imports` (the active per-module table the
|
||||||
// itself does not import itself.
|
// body-check pass reads); the sibling block in `build_check_env`
|
||||||
|
// populates `env.module_imports` (the workspace-wide table
|
||||||
|
// referenced when resolving qualified names across modules).
|
||||||
|
// Both fields need the prelude-injection rule applied, and they
|
||||||
|
// are populated from different code paths — hence the apparent
|
||||||
|
// duplication. The prelude itself does not import itself.
|
||||||
if m.name != "prelude" {
|
if m.name != "prelude" {
|
||||||
import_map
|
import_map
|
||||||
.entry("prelude".to_string())
|
.entry("prelude".to_string())
|
||||||
@@ -1978,8 +1983,10 @@ pub(crate) fn synth(
|
|||||||
} else {
|
} else {
|
||||||
// Iter 23.1.3: bare type-name not present locally —
|
// Iter 23.1.3: bare type-name not present locally —
|
||||||
// scan imported modules for a type by this name.
|
// scan imported modules for a type by this name.
|
||||||
// Symmetric to `Pattern::Ctor`'s fallback at this
|
// Symmetric to the Iter 15a imports-fallback applied
|
||||||
// file's ~lib.rs:2453; required so an LLM author can
|
// to `Pattern::Ctor` resolution (search this file for
|
||||||
|
// "Iter 15a: try local ctor_index first" to find the
|
||||||
|
// canonical comment). Required so an LLM author can
|
||||||
// write `(con Ordering LT)` against a prelude type
|
// write `(con Ordering LT)` against a prelude type
|
||||||
// without qualifying it as `prelude.Ordering`. The
|
// without qualifying it as `prelude.Ordering`. The
|
||||||
// result `Type::Con` carries the qualified name so
|
// result `Type::Con` carries the qualified name so
|
||||||
|
|||||||
Reference in New Issue
Block a user