Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes to improve the type annotations #53

Merged
merged 2 commits into from
Feb 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/xdsl/irdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class OptResultDef(VarResultDef, OptionalDef):


@dataclass
class RegionDef:
class RegionDef(Region):
"""
An IRDL region definition.
If the block_args is specified, then the region expect to have the entry block with these arguments.
Expand Down Expand Up @@ -531,11 +531,7 @@ def irdl_op_builder(cls: typing.Type[OpT], operands: List,
regions=regions)


OperationType = TypeVar("OperationType", bound=Operation)


def irdl_op_definition(
cls: typing.Type[OperationType]) -> typing.Type[OperationType]:
def irdl_op_definition(cls: typing.Type[Operation]) -> typing.Type[_]:
"""Decorator used on classes to define a new operation definition."""

assert issubclass(
Expand Down Expand Up @@ -631,7 +627,7 @@ def builder(cls,

new_attrs["build"] = classmethod(builder)

return type(cls.__name__, (cls, ), {**cls.__dict__, **new_attrs})
return type(cls.__name__, cls.__mro__, {**cls.__dict__, **new_attrs})


@dataclass
Expand Down