fix: use ctx.toolchains[] subscript instead of nonexistent .get()#465
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ToolchainContexthas no.get()method — toolchain access is via subscript(
ctx.toolchains[type]). Two call sites usedctx.toolchains.get(...), whichfails at the analysis phase with:
common/wasm_component_utils.bzl—validate_component_action(), reachedwhenever a component rule sets
validate_wit = Truewit/private/wit_bindgen.bzl— the Go binding-generation pathBoth now use the
ctx.toolchains[...]subscript form — matching thealready-correct usage 6 lines below in
wit_bindgen.bzl.Introduced in
6bbd9873(2026-03-22).Validation
The previously analysis-failing
//examples/multi_profileand//examples/world_exporttargets 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 crashand is unrelated to this change.
🤖 Generated with Claude Code