Skip to content

Commit

Permalink
ci: ignore more pyright errors in the frontend (#2895)
Browse files Browse the repository at this point in the history
  • Loading branch information
superlopuh authored Jul 17, 2024
1 parent ed144cf commit 1da5f9f
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 23 deletions.
15 changes: 12 additions & 3 deletions tests/filecheck/frontend/dialects/affine.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def test_affine_for_IV():
with CodeContext(p):
# CHECK: Expected integer constant for loop end, got 'float'.
def test_not_supported_affine_loop_I():
for _ in range(12.0): # pyright: ignore[reportGeneralTypeIssues]
for _ in range(
12.0 # pyright: ignore[reportArgumentType, reportGeneralTypeIssues]
):
pass
return

Expand All @@ -87,7 +89,10 @@ def test_not_supported_affine_loop_I():
with CodeContext(p):
# CHECK: Expected integer constant for loop start, got 'str'.
def test_not_supported_affine_loop_II():
for _ in range("boom", 100): # pyright: ignore[reportGeneralTypeIssues]
for _ in range(
"boom", # pyright: ignore[reportArgumentType, reportGeneralTypeIssues]
100,
):
pass
return

Expand All @@ -100,7 +105,11 @@ def test_not_supported_affine_loop_II():
with CodeContext(p):
# CHECK: Expected integer constant for loop step, got 'float'.
def test_not_supported_affine_loop_III():
for _ in range(0, 100, 1.0): # pyright: ignore[reportGeneralTypeIssues]
for _ in range(
0,
100,
1.0, # pyright: ignore[reportArgumentType, reportGeneralTypeIssues]
):
pass
return

Expand Down
2 changes: 1 addition & 1 deletion tests/test_traits.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def test_traits_undefined():
class WrongTraitsType(IRDLOperation):
name = "test.no_traits"

traits = 1 # pyright: ignore[reportGeneralTypeIssues]
traits = 1 # pyright: ignore[reportGeneralTypeIssues, reportAssignmentType]


def test_traits_wrong_type():
Expand Down
60 changes: 42 additions & 18 deletions xdsl/frontend/dialects/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def __add__(
from xdsl.frontend.dialects.arith import addi

return addi(
self, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType]
other, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType]
self, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType, reportArgumentType]
other, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType, reportArgumentType]
)

def __and__(
Expand All @@ -49,8 +49,8 @@ def __and__(
from xdsl.frontend.dialects.arith import andi

return andi(
self, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType]
other, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType]
self, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType, reportArgumentType]
other, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType, reportArgumentType]
)

def __lshift__(
Expand All @@ -59,8 +59,8 @@ def __lshift__(
from xdsl.frontend.dialects.arith import shli

return shli(
self, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType]
other, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType]
self, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType, reportArgumentType]
other, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType, reportArgumentType]
)

def __mul__(
Expand All @@ -69,8 +69,8 @@ def __mul__(
from xdsl.frontend.dialects.arith import muli

return muli(
self, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType]
other, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType]
self, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType, reportArgumentType]
other, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType, reportArgumentType]
)

def __rshift__(
Expand All @@ -79,8 +79,8 @@ def __rshift__(
from xdsl.frontend.dialects.arith import shrsi

return shrsi(
self, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType]
other, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType]
self, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType, reportArgumentType]
other, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType, reportArgumentType]
)

def __sub__(
Expand All @@ -89,43 +89,67 @@ def __sub__(
from xdsl.frontend.dialects.arith import subi

return subi(
self, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType]
other, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType]
self, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType, reportArgumentType]
other, # pyright: ignore[reportGeneralTypeIssues, reportUnknownVariableType, reportArgumentType]
)

def __eq__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: _Integer[_Width, _Signedness]
) -> i1:
from xdsl.frontend.dialects.arith import cmpi

return cmpi(self, other, "eq") # pyright: ignore[reportGeneralTypeIssues]
return cmpi(
self, # pyright: ignore[reportGeneralTypeIssues, reportArgumentType]
other, # pyright: ignore[reportGeneralTypeIssues, reportArgumentType]
"eq",
)

def __ge__(self, other: _Integer[_Width, _Signedness]) -> i1:
from xdsl.frontend.dialects.arith import cmpi

return cmpi(self, other, "sge") # pyright: ignore[reportGeneralTypeIssues]
return cmpi(
self, # pyright: ignore[reportGeneralTypeIssues, reportArgumentType]
other, # pyright: ignore[reportGeneralTypeIssues, reportArgumentType]
"sge",
)

def __gt__(self, other: _Integer[_Width, _Signedness]) -> i1:
from xdsl.frontend.dialects.arith import cmpi

return cmpi(self, other, "sgt") # pyright: ignore[reportGeneralTypeIssues]
return cmpi(
self, # pyright: ignore[reportGeneralTypeIssues, reportArgumentType]
other, # pyright: ignore[reportGeneralTypeIssues, reportArgumentType]
"sgt",
)

def __le__(self, other: _Integer[_Width, _Signedness]) -> i1:
from xdsl.frontend.dialects.arith import cmpi

return cmpi(self, other, "sle") # pyright: ignore[reportGeneralTypeIssues]
return cmpi(
self, # pyright: ignore[reportGeneralTypeIssues, reportArgumentType]
other, # pyright: ignore[reportGeneralTypeIssues, reportArgumentType]
"sle",
)

def __lt__(self, other: _Integer[_Width, _Signedness]) -> i1:
from xdsl.frontend.dialects.arith import cmpi

return cmpi(self, other, "slt") # pyright: ignore[reportGeneralTypeIssues]
return cmpi(
self, # pyright: ignore[reportGeneralTypeIssues, reportArgumentType]
other, # pyright: ignore[reportGeneralTypeIssues, reportArgumentType]
"slt",
)

def __ne__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: _Integer[_Width, _Signedness]
) -> i1:
from xdsl.frontend.dialects.arith import cmpi

return cmpi(self, other, "ne") # pyright: ignore[reportGeneralTypeIssues]
return cmpi(
self, # pyright: ignore[reportGeneralTypeIssues, reportArgumentType]
other, # pyright: ignore[reportGeneralTypeIssues, reportArgumentType]
"ne",
)


# Type aliases for signless integers.
Expand Down
2 changes: 1 addition & 1 deletion xdsl/frontend/type_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import (
Any,
TypeAlias,
_GenericAlias, # pyright: ignore[reportPrivateUsage, reportGeneralTypeIssues, reportUnknownVariableType]
_GenericAlias, # pyright: ignore[reportPrivateUsage, reportGeneralTypeIssues, reportUnknownVariableType, reportAttributeAccessIssue]
)

import xdsl.dialects.builtin as xdsl_builtin
Expand Down

0 comments on commit 1da5f9f

Please sign in to comment.