Skip to content

fix: use ctx.toolchains[] subscript instead of nonexistent .get()#465

Merged
avrabe merged 1 commit into
mainfrom
fix/toolchains-context-get
May 20, 2026
Merged

fix: use ctx.toolchains[] subscript instead of nonexistent .get()#465
avrabe merged 1 commit into
mainfrom
fix/toolchains-context-get

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 20, 2026

Summary

ToolchainContext has no .get() method — toolchain access is via subscript
(ctx.toolchains[type]). Two call sites used ctx.toolchains.get(...), which
fails at the analysis phase with:

Error: 'ToolchainContext' value has no field or method 'get'
  • common/wasm_component_utils.bzlvalidate_component_action(), reached
    whenever a component rule sets validate_wit = True
  • wit/private/wit_bindgen.bzl — the Go binding-generation path

Both now use the ctx.toolchains[...] subscript form — matching the
already-correct usage 6 lines below in wit_bindgen.bzl.

Introduced in 6bbd9873 (2026-03-22).

Validation

The previously analysis-failing //examples/multi_profile and
//examples/world_export targets now pass analysis.

Note: those examples still fail later on a separate, pre-existing
wit-bindgen world-name mismatch (World 'sensor' not found in package 'sensor:interfaces@0.1.0') — that bug was masked behind this analysis crash
and is unrelated to this change.

🤖 Generated with Claude Code

ToolchainContext has no .get() method — toolchain access is via subscript.
Two call sites used ctx.toolchains.get(...), which fails at analysis with
"'ToolchainContext' value has no field or method 'get'":

- common/wasm_component_utils.bzl: validate_component_action(), hit whenever
  a component rule sets validate_wit = True
- wit/private/wit_bindgen.bzl: the Go binding-generation path

Both now use the ctx.toolchains[...] subscript form, matching the already-
correct usage 6 lines below in wit_bindgen.bzl.

Introduced in 6bbd987 (2026-03-22). Validated: the previously
analysis-failing //examples/multi_profile and //examples/world_export targets
now pass analysis. (They still fail later on a separate, pre-existing
wit-bindgen world-name mismatch — unrelated to this fix.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit c29c2f9 into main May 20, 2026
41 of 42 checks passed
@avrabe avrabe deleted the fix/toolchains-context-get branch May 20, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant