Skip to content

Commit

Permalink
better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
superlopuh committed Feb 19, 2025
1 parent ecccb15 commit b941802
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion tests/backend/test_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ def infinite_register_prefix(cls):


def test_register_clashes():
with pytest.raises(AssertionError, match="Invalid 'infinite' register name x"):
with pytest.raises(
AssertionError,
match="Invalid 'infinite' register name: x0 clashes with finite register set",
):
TestRegister.infinite_register(0)
6 changes: 3 additions & 3 deletions xdsl/backend/register_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def infinite_register(cls, index: int) -> Self:
"""
Provide the register at the given index in the "infinite" register set.
"""
spelling = cls.infinite_register_prefix()
res = cls(spelling + str(index))
spelling = cls.infinite_register_prefix() + str(index)
res = cls(spelling)
assert isinstance(res.index, NoneAttr), (
f"Invalid 'infinite' register name {spelling}"
f"Invalid 'infinite' register name: {spelling} clashes with finite register set"
)
return res

0 comments on commit b941802

Please sign in to comment.