Skip to content

wit-component: fix async task.return options for export signatures#2452

Merged
alexcrichton merged 3 commits intobytecodealliance:mainfrom
peter-jerry-ye:zihang/fix-utf8
Mar 2, 2026
Merged

wit-component: fix async task.return options for export signatures#2452
alexcrichton merged 3 commits intobytecodealliance:mainfrom
peter-jerry-ye:zihang/fix-utf8

Conversation

@peter-jerry-ye
Copy link
Contributor

@peter-jerry-ye peter-jerry-ye commented Feb 27, 2026

Hi maintainers,

DISCLAIMER : I generated this fix using AI

This PR addresses #2301 by ensuring async task.return options are derived from the full exported function signature, not only the immediate return type.

What this changes

  • Adds a regression test first (async-task-return-param-string) with snapshots that make the expected task.return options explicit.
  • Fixes option calculation for async export task.return by using the full Function context.

Why this fixes #2301

Issue #2301 reports invalid task.return signature/options in async scenarios involving strings/encodings. This change propagates required canonical ABI options from the relevant async signature data, so task.return is emitted with the correct options in these cases.

Notes

  • Commit order is intentionally: regression test first, fix second.
  • The new regression includes snapshot output to show the behavioral diff clearly.

Testing

  • cargo test -p wit-component --test components async-task-return-param-string
  • cargo test -p wit-component --test components async-streams-and-futures

Thank you for taking a look.

@peter-jerry-ye peter-jerry-ye requested a review from a team as a code owner February 27, 2026 02:58
@peter-jerry-ye peter-jerry-ye requested review from alexcrichton and removed request for a team February 27, 2026 02:58
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@alexcrichton alexcrichton added this pull request to the merge queue Mar 2, 2026
Merged via the queue into bytecodealliance:main with commit 70394c5 Mar 2, 2026
36 checks passed
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.

component model async: wrong string encoding in task.return intrinsic

2 participants