Skip to content

Commit 0726f51

Browse files
authored
Change @number_methods instead
1 parent a335548 commit 0726f51

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/methods.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ function number_methods(T, rhs1, rhs2, options=nothing)
7777
end
7878

7979
push!(exprs, expr)
80+
81+
# Fix method ambiguity error on NaNMath >= 1.0.2 and promotion of `Integer`s on NaNMath < 1.0.2
82+
if f === NaNMath.pow
83+
push!(exprs, :($(NaNMath.pow)(a::$T, b::Integer) = ($assert_like($(NaNMath.pow), Number, a); $term($(^), a, b))))
84+
end
8085
end
8186

8287
for f in (skip_basics ? monadic : only_basics ? basic_monadic : vcat(basic_monadic, monadic))
@@ -98,9 +103,6 @@ end
98103
@number_methods(BasicSymbolic{<:Number}, term(f, a), term(f, a, b), skipbasics)
99104
@number_methods(BasicSymbolic{<:LiteralReal}, term(f, a), term(f, a, b), onlybasics)
100105

101-
# Fix method ambiguity issue in NaNMath >= 1.0.2
102-
NaNMath.pow(x::BasicSymbolic{<:Number}, y::Integer) = x^y
103-
104106
for f in vcat(diadic, [+, -, *, \, /, ^])
105107
@eval promote_symtype(::$(typeof(f)),
106108
T::Type{<:Number},

0 commit comments

Comments
 (0)