Skip to content

Commit

Permalink
Fix optional patterns without default values for the given positions.
Browse files Browse the repository at this point in the history
  • Loading branch information
aravindh-krishnamoorthy committed Nov 19, 2024
1 parent 85ad0f5 commit c1999ce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mathics/core/pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,11 @@ def match_expression_with_one_identity(
result = defaultvalue_expr.evaluate(evaluation)
assert result is not None
if result.sameQ(defaultvalue_expr):
return
optionals[key] = result
# The optional pattern has no default value
# for the given position
new_pattern = pat_elem
else:
optionals[key] = result
else:
return
elif new_pattern is not None:
Expand Down

0 comments on commit c1999ce

Please sign in to comment.