From 50ab2fc48e3bdc3c54a71bce47726eb7915eefbe Mon Sep 17 00:00:00 2001 From: Michel Weber Date: Fri, 17 Jun 2022 13:35:14 +0200 Subject: [PATCH] fix failing test case --- src/xdsl/irdl.py | 4 ++++ tests/attribute_definition_test.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/xdsl/irdl.py b/src/xdsl/irdl.py index 420e5eb92e..ba76db025b 100644 --- a/src/xdsl/irdl.py +++ b/src/xdsl/irdl.py @@ -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) diff --git a/tests/attribute_definition_test.py b/tests/attribute_definition_test.py index c54d228f05..a5c26af79b 100644 --- a/tests/attribute_definition_test.py +++ b/tests/attribute_definition_test.py @@ -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