Skip to content

Commit e0c671f

Browse files
committed
fix: exponents
1 parent c9cc50b commit e0c671f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/TracedRArray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ for (jlop, hloop) in (
267267
function $(jlop)(
268268
@nospecialize(lhs::TracedRArray{T1,0}), @nospecialize(rhs::TracedRArray{T2,0})
269269
) where {T1,T2}
270-
commonTy = promote_type(T1, T2)
270+
commonTy = TracedRArray{Base.promote_type(T1, T2),0}
271271
lhs = promote_to(commonTy, lhs)
272272
rhs = promote_to(commonTy, rhs)
273273
return $(jlop)(lhs, rhs)

test/bcast.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,14 @@ end
101101
ln_comp = @compile custom_ln(x_ra)
102102
@test ln_comp(x_ra) custom_ln(x)
103103
end
104+
105+
pow(x, n) = x .^ n
106+
107+
@testset "Pow" begin
108+
x = rand(2, 3)
109+
x_ra = Reactant.to_rarray(x)
110+
111+
pow_compiled = @compile pow(x_ra, 2)
112+
113+
@test pow_compiled(x_ra) pow(x, 2)
114+
end

0 commit comments

Comments
 (0)