So here is an example of how broken this is. I have the following code:
println(par_type, " ", T2, " ", Base.promote_rule(par_type, T2), " ",
Base.promote_rule(par_type, T2) != par_type)
if Base.promote_rule(par_type, T2) != par_type
eval(:(Base.promote_rule(::Type{$par_type}, ::Type{$T2}) =
$par_type))
end
So it's supposed to check if the promote_rule already returns its first
argument and omit defining the promote_rule if it does.
Here is what it prints:
Nemo.Poly{Nemo.fmpz_poly} Nemo.fmpz Union{} true
WARNING: Method definition promote_rule(Type{Nemo.Poly{Nemo.fmpz_poly}},
Type{Nemo.fmpz}) in module Nemo at
/home/wbhart/.julia/v0.5/Nemo/src/generic/Poly.jl:1754 overwritten at
/home/wbhart/.julia/v0.5/Nemo/src/generic/Poly.jl:1754.
In other words, it tells me that the promote_rule does not exist, so goes
ahead and creates it, and then tells me that it already exists.
This is clearly totally broken. I strongly suspect this is a bug related to
the equality problem I outlined in the first post.
Bill.