Skip to content

Commit

Permalink
Specialize in(x::Num, I::AbstractInterval)
Browse files Browse the repository at this point in the history
Along with JuliaMath/IntervalSets.jl#126, this helps avoid ambiguities such as in JuliaApproximation/ApproxFun.jl#847
  • Loading branch information
jishnub authored Nov 30, 2022
1 parent 1668887 commit 37004ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/domains.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ struct VarDomainPairing
domain::Domain
end

Base.:(variable::Union{Sym,Term,Num},domain::Domain) = VarDomainPairing(value(variable),domain)
Base.:(variable::Union{Sym,Term,Num},domain::Interval) = VarDomainPairing(value(variable),domain)
for D in [:Domain, :Interval, :AbstractInterval]
@eval Base.:(variable::Union{Sym,Term,Num},domain::$D) = VarDomainPairing(value(variable),domain)
end

# Construct Interval domain from a Tuple
Base.:(variable::Union{Sym,Term,Num},domain::NTuple{2,Real}) = VarDomainPairing(variable,Interval(domain...))
Expand Down

0 comments on commit 37004ab

Please sign in to comment.