Skip to content

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

Draft
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_945967740
Draft

Refactor builder channel and state element API to store errors on the builder.#4557
copybara-service[bot] wants to merge 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.

… 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: 945967740
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