Skip to content

Commit

Permalink
note ref involved in cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
tjjfvi committed Apr 1, 2024
1 parent eb6b470 commit 4664edb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ pub mod prune;
#[derive(Debug, Error, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum TransformError {
#[error("infinite reference cycle")]
InfiniteRefCycle,
#[error("infinite reference cycle in `@{0}`")]
InfiniteRefCycle(String),
}
2 changes: 1 addition & 1 deletion src/transform/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl InlineState {
if parity {
let Tree::Ref { nam: tortoise_nam } = tortoise else { unreachable!() };
if tortoise_nam == nam {
Err(TransformError::InfiniteRefCycle)?;
Err(TransformError::InfiniteRefCycle(nam.to_owned()))?;
}
tortoise = &book.nets[tortoise_nam].root;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub fn test_inline() {
"###);

for net in ["@a = @a", "@a = @b @b = @c @c = @d @d = @e @e = @f @f = @c"] {
assert_eq!(parse_and_inline(net), Err(TransformError::InfiniteRefCycle));
assert!(matches!(parse_and_inline(net), Err(TransformError::InfiniteRefCycle(_))));
}
}

Expand Down

0 comments on commit 4664edb

Please sign in to comment.