Skip to content

Commit

Permalink
Fix call of promote_operation in @rewrite (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat authored Oct 12, 2021
1 parent 3f455a4 commit 4462827
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rewrite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ function _rewrite(
# non-trivial expression that also needs to be re-written. We need
# `!vectorized` otherwise `A .+ (A + A)^2` would be rewritten as
# `broadcast!(add_mul, x, AA, AA)` where `AA` is `A + A`.
MulType = :(MA.promote_operation(
MulType = :(MutableArithmetics.promote_operation(
*,
typeof($(inner_factor.args[2])),
typeof($(inner_factor.args[2])),
Expand Down
4 changes: 4 additions & 0 deletions test/hygiene.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ x = MutableArithmetics.@rewrite sum(i * j for i = 1:4 for j ∈ 1:4 if i == j)
x = @_rewrite sum(i * j for i = 1:4 for j 1:4 if i == j)
@test x == 30

x = big(1)
y = MutableArithmetics.@rewrite(x + (x + 1)^1)
@test y == 3

end

0 comments on commit 4462827

Please sign in to comment.