Skip to content

feat: per-component resource import tracking for 3-component borrow forwarding#34

Merged
avrabe merged 2 commits intomainfrom
fix/per-component-resource-tracking
Mar 17, 2026
Merged

feat: per-component resource import tracking for 3-component borrow forwarding#34
avrabe merged 2 commits intomainfrom
fix/per-component-resource-tracking

Conversation

@avrabe
Copy link
Contributor

@avrabe avrabe commented Mar 17, 2026

Summary

  • Adds resource_rep_by_component and resource_new_by_component maps to MergedModule
  • Populated during add_unresolved_imports when processing [resource-rep]/[resource-new] function imports
  • Adapter generator uses per-component maps (with layered fallback) to find correct [resource-rep] for caller and [resource-new] for callee
  • Extends synthesize_missing_resource_imports to synthesize callee's [resource-new] for 3-component chains

Progress on resource_floats

The adapter now correctly generates: caller_resource_rep(handle) → rep → callee_resource_new(rep) → new_handle

Remaining blocker: P2 wrapper resource type mismatch — the [resource-new] and [resource-rep] for the intermediate's exports instance are backed by different resource type definitions. This is a component_wrap.rs issue.

Test plan

  • 73 tests pass, 0 failures
  • Pre-commit hooks pass

🤖 Generated with Claude Code

avrabe and others added 2 commits March 17, 2026 06:11
…orwarding

Adds resource_rep_by_component and resource_new_by_component maps to
MergedModule, populated during add_unresolved_imports. The adapter
generator uses these to find the correct component's [resource-rep]
and [resource-new] in multi-component chains.

For resource_floats, the adapter now correctly generates:
  caller_resource_rep(handle) → rep → callee_resource_new(rep) → new_handle

The remaining blocker is a P2 wrapper resource type mismatch: the
[resource-new] and [resource-rep] for the intermediate component's
exports instance are backed by different resource types.

Also extends synthesize_missing_resource_imports to synthesize
callee's [resource-new] for 3-component chains.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit e4e32ff into main Mar 17, 2026
3 checks passed
@avrabe avrabe deleted the fix/per-component-resource-tracking branch March 17, 2026 05:24
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