fix: codegen lower_workspace_inner implicit prelude import (4th lockstep site)

This commit is contained in:
2026-05-10 22:44:37 +02:00
parent 7172e7e8c9
commit be882c4ef8
+14
View File
@@ -376,6 +376,20 @@ fn lower_workspace_inner(ws: &Workspace, alloc: AllocStrategy) -> Result<String>
let key = imp.alias.clone().unwrap_or_else(|| imp.module.clone());
import_map.insert(key, imp.module.clone());
}
// Iter 23.2 (fourth lockstep site, after Pattern::Ctor 15a /
// Term::Ctor typecheck / lookup_ctor_by_type codegen): mirror
// the typechecker's implicit-prelude import injection
// (crates/ailang-check/src/lib.rs:1198 and :1300). User
// modules that call prelude-resident fns synthesised by Iter
// 22b.3 monomorphisation (e.g. `prelude.eq__Int` from a user
// calling `eq x y` on Ints) need the codegen-side import_map
// to resolve the `prelude.` prefix at the call site
// (`lower_call`'s prefix lookup).
if m.name != "prelude" {
import_map
.entry("prelude".to_string())
.or_insert_with(|| "prelude".to_string());
}
let mut emitter = Emitter::new(
m,