Skip to content

Commit

Permalink
fix failing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
webmiche committed Jun 21, 2022
1 parent 52bfe7d commit 50ab2fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/xdsl/irdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,10 @@ def irdl_data_definition(cls: type[T]) -> type[T]:
raise Exception(f'In {cls.__name__} definition: Cannot infer '
f'"verify" method. Type parameter of Data is '
f'not a class.')
if isinstance(expected_type, types.GenericAlias):
raise Exception(f'In {cls.__name__} definition: Cannot infer '
f'"verify" method. Type parameter of Data has '
f'type GenericAlias.')
new_attrs[
"verify"] = lambda self, expected_type=expected_type: irdl_data_verify(
self, expected_type)
Expand Down
3 changes: 2 additions & 1 deletion tests/attribute_definition_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def test_data_with_non_class_param_missing_verifier_failure():
irdl_attr_definition(IntListMissingVerifierData)
assert e.value.args[0] == (
'In IntListMissingVerifierData definition: '
'Cannot infer "verify" method. Type parameter of Data is not a class.')
'Cannot infer "verify" method. Type parameter of Data has type GenericAlias.'
)


@irdl_attr_definition
Expand Down

0 comments on commit 50ab2fc

Please sign in to comment.