refactor(ir): extract CallResolver for call result typing (A3.2 relocation)
Move call-result-type discovery out of Lowering into a new src/ir/calls.zig (CallResolver): the A3.1 Lowering.inferCallType body moves verbatim into CallResolver.resultType. inferExprType's `.call` arm now delegates via callResolver(); Lowering.inferCallType is gone. CallResolver is a *Lowering facade (Principle 5, like ExprTyper/PackResolver): call typing reads live lexical-scope / target-type state and the function / foreign-class / protocol resolver helpers, so it borrows *Lowering. Transform was `self.` -> `self.l.` plus the file-local static `resolveBuiltin(` -> `Lowering.resolveBuiltin(`. Widened to pub only what the facade actually consumes: resolveTypeArg, inferGenericReturnType, resolveFuncByName, getProtocolInfo, resolveForeignMethodReturnType, the static resolveBuiltin, and Scope.lookupFn. resolveTypeArg widening is genuinely required here — the `cast` builtin's result type calls it. calls.test.zig adds focused tests (builtin/reflection classification, unknown callee -> unresolved) for the scope-free paths. Barrel-wired in ir.zig. This is the relocation half of PLAN-ARCH A3.2; call LOWERING (lowerCall) still owns its own dispatch, and the CallPlan convergence (one plan shared by typing and lowering, deleting the duplicated qualified/bare/lazy logic) remains. Behavior-preserving. Gate: zig build, zig build test (incl. new CallResolver tests), bash tests/run_examples.sh -> 356/0. lower.zig 18598 -> 18413.
This commit is contained in:
@@ -8,6 +8,7 @@ pub const program_index = @import("program_index.zig");
|
||||
pub const type_resolver = @import("type_resolver.zig");
|
||||
pub const packs = @import("packs.zig");
|
||||
pub const expr_typer = @import("expr_typer.zig");
|
||||
pub const calls = @import("calls.zig");
|
||||
pub const semantic_diagnostics = @import("semantic_diagnostics.zig");
|
||||
|
||||
pub const TypeId = types.TypeId;
|
||||
@@ -40,6 +41,7 @@ pub const TypeResolver = type_resolver.TypeResolver;
|
||||
pub const ResolveEnv = type_resolver.ResolveEnv;
|
||||
pub const PackResolver = packs.PackResolver;
|
||||
pub const ExprTyper = expr_typer.ExprTyper;
|
||||
pub const CallResolver = calls.CallResolver;
|
||||
|
||||
pub const compiler_hooks = @import("compiler_hooks.zig");
|
||||
pub const emit_llvm = @import("emit_llvm.zig");
|
||||
@@ -62,6 +64,7 @@ pub const program_index_tests = @import("program_index.test.zig");
|
||||
pub const type_resolver_tests = @import("type_resolver.test.zig");
|
||||
pub const packs_tests = @import("packs.test.zig");
|
||||
pub const expr_typer_tests = @import("expr_typer.test.zig");
|
||||
pub const calls_tests = @import("calls.test.zig");
|
||||
pub const type_bridge_tests = @import("type_bridge.test.zig");
|
||||
pub const emit_llvm_tests = @import("emit_llvm.test.zig");
|
||||
pub const jni_descriptor_tests = @import("jni_descriptor.test.zig");
|
||||
|
||||
Reference in New Issue
Block a user