Skip to content

Tool-mode compiles of compiler-library tools fail at codegen: unresolved field types (MirBuilder.cur_bb, CiMigrate structs) #705

Closed

Description

@ehartford

Every tool that pulls compiler.Compilation as a library (tools/annotate_receivers.w, tools/migrate_method_arg_moves.w — including pristine HEAD copies) fails under the current seed+tree at code generation with 'unresolved type for field', e.g. cur_bb in MirBuilder, several CiMigrate IR structs. with check src/main.w is clean; only the tool-mode root shape trips it. Both of today's archived seeds reproduce; a pre-batch worktree couldn't be tested (missing generated out/gen modules). Needs bisection over today's commits with per-commit stage1s, or lldb on the codegen branch that fails to resolve the field type. Found while running the #691 migration tooling; the migration proceeded via a TSV-driven byte splicer instead.

Activity

  1. ehartford commented on Jul 27, 2026

    @ehartford
    ContributorAuthor

    Fixed in 57842ad. Root cause: codegen's frozen type resolution (resolve_type_expr_frozen → lookup_named_type_visible → decl_visible_from_current) evaluated module visibility from sema.current_module_path, which codegen never set — it stayed at the compilation root. src/main.w as root shares the src/ internal-implementation boundary with every compiler module, so compiler builds never noticed; a tool root outside src/ made non-pub cross-module distinct aliases (Mir.BlockId in MirBuilder.cur_bb, CiTypeId in CImport IR structs) invisible, and pass-0b struct layout failed. sync_decl_context now points sema.current_module_path at the declaring module, matching ComptimeEval/MirLower's established save-set pattern. Verified with a minimal 'use compiler.Compilation' tool root and with tools/migrate_shareplace.w running its full fact+lex pass on stage1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions