-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Cleaner error on wiring errors while building (#873)
Adds a new `BuilderWiringError`, that gets wrapper under either `BuildError::OutputWiring` or `BuildError::OperationWiring` when passing a wrong set of input wires to a builder method. The goal of this is to report useful information about the errors to the user. Now we can give a bit more context, including the location in the hugr. Compare the old error: ``` Can't copy linear type: Type(Extension(CustomType { extension: IdentList("prelude"), id: "qubit", args: [], bound: Any }), Any). ``` With: ``` Found an error while setting the outputs of a FuncDefn container, Node(1). Cannot copy linear type qubit from output Port(Outgoing, 0) of node Node(2) ``` Although the have the location of the error, we may still not have access to the Hugr being built (e.g. if calling `finish_hugr`). I'll open an issue for addressing that.
- Loading branch information
Showing
4 changed files
with
141 additions
and
51 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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