Skip to content

Commit

Permalink
Vaguely accommodate old floopy behavior of None dimensions in shape
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Nov 7, 2024
1 parent 8f0c97f commit 3ece99a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions loopy/kernel/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,11 @@ def parse_arith(x: ExpressionT | str) -> ArithmeticExpressionT:
else:
res = x

# The Fortran parser may do this, but this is (deliberately) outside
# the behavior allowed by types, because the hope is to phase it out.
if x is None:
return x

assert is_arithmetic_expression(res)
return res

Expand Down
2 changes: 2 additions & 0 deletions loopy/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
from pymbolic.typing import ArithmeticExpressionT, ExpressionT, IntegerT


# The Fortran parser may insert dimensions of 'None', but I'd like to phase
# that out, so we're not encoding that in the type.
ShapeType: TypeAlias = Tuple[ArithmeticExpressionT, ...]
StridesType: TypeAlias = ShapeType

Expand Down

0 comments on commit 3ece99a

Please sign in to comment.