JuliaFunctional / DataTypesBasic.jl

Option, Try, Either, and some more common basic DataTypes
MIT License
12 stars 4 forks source link

method ambiguities #1

Closed JeffBezanson closed 2 years ago

JeffBezanson commented 3 years ago

I believe these ambiguous pairs are actually ambiguous:

merge(e::Exception, f::Thrown) in DataTypesBasic at /home/jeff/.julia/packages/DataTypesBasic/N51Nm/src/Try.jl:91
merge(es::MultipleExceptions, e::Exception) in DataTypesBasic at /home/jeff/.julia/packages/DataTypesBasic/N51Nm/src/Try.jl:92)
run(cont, c::ContextManager) in DataTypesBasic at /home/jeff/.julia/packages/DataTypesBasic/N51Nm/src/ContextManager.jl:78
run(cmds::Base.AbstractCmd, args...; wait) in Base at process.jl:437
merge(f::Thrown, e::Exception) in DataTypesBasic at /home/jeff/.julia/packages/DataTypesBasic/N51Nm/src/Try.jl:90
merge(e::Exception, fs::MultipleExceptions) in DataTypesBasic at /home/jeff/.julia/packages/DataTypesBasic/N51Nm/src/Try.jl:93

The promote_rule methods are also a big problem for the compiler, e.g. https://github.com/JuliaLang/julia/pull/38810 adds this one:

promote_rule(::Type{Union{Const{L2}, Identity{R1}}}, ::Type{Union{Const{L1}, Identity{R2}}}) where {L1, R1, L2<:L1, R2<:R1} in DataTypesBasic at /home/jeff/.julia/packages/DataTypesBasic/N51Nm/src/promote_type.jl:108
promote_rule(::Type{Union{Const{L1}, Identity{R}}}, ::Type{Union{Const{L2}, Identity{R}}}) where {L1, R, L2} in DataTypesBasic at /home/jeff/.julia/packages/DataTypesBasic/N51Nm/src/promote_type.jl:110

That one might not be a real ambiguity, but I would still consider maybe just deleting promote_type.jl.

JeffBezanson commented 3 years ago

Also note that tests pass if you remove @test isempty(detect_ambiguities(DataTypesBasic)), so that's also an option :stuck_out_tongue:

schlichtanders commented 2 years ago

Hi @JeffBezanson. I am a bit late to the game, but thank you so much for your pointers.

The ambiguity checks seem to have changed quite a bit with newer Julia versions. All ambiguities are solved now 👍.