Skip to content

Refactor builder channel and state element API to store errors on the builder.#4557

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_945967740
Jul 20, 2026
Merged

Refactor builder channel and state element API to store errors on the builder.#4557
copybara-service[bot] merged 1 commit into
mainfrom
test_945967740

Conversation

@copybara-service

Copy link
Copy Markdown

Refactor builder channel and state element API to store errors on the builder.

Currently, various builder methods like AddInputChannel, AddOutputChannel, AddChannel, and UnreadStateElement return StatusOr<...> values which require checking using XLS_ASSIGN_OR_RETURN or XLS_ASSERT_OK_AND_ASSIGN.

This change refactors these methods to return wrapper types BReceiveChannel, BSendChannel, BChannel, BChannelWithInterfaces, and BStateElement and to store any validation failures or errors inside the builder itself (analogous to how BValue works). This makes the builder API cleaner and more ergonomic.

All tests and translation logic have been updated to match the new API.

@copybara-service
copybara-service Bot force-pushed the test_945967740 branch 2 times, most recently from 48fd204 to 8eab866 Compare July 13, 2026 19:12
@copybara-service
copybara-service Bot force-pushed the test_945967740 branch 6 times, most recently from af3f75e to b1dadde Compare July 20, 2026 21:55
… builder.

Currently, various builder methods like `AddInputChannel`, `AddOutputChannel`, `AddChannel`, and `UnreadStateElement` return `StatusOr<...>` values which require checking using `XLS_ASSIGN_OR_RETURN` or `XLS_ASSERT_OK_AND_ASSIGN`.

This change refactors these methods to return wrapper types `BReceiveChannel`, `BSendChannel`, `BChannel`, `BChannelWithInterfaces`, and `BStateElement` and to store any validation failures or errors inside the builder itself (analogous to how `BValue` works). This makes the builder API cleaner and more ergonomic.

All tests and translation logic have been updated to match the new API.

PiperOrigin-RevId: 951103808
@copybara-service
copybara-service Bot merged commit 5527b2c into main Jul 20, 2026
@copybara-service
copybara-service Bot deleted the test_945967740 branch July 20, 2026 23:04
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