Skip to content

Commit 8b721a0

Browse files
fixed new disambiguation errors
1 parent 65eb4d1 commit 8b721a0

5 files changed

Lines changed: 11 additions & 9 deletions

File tree

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
### Fixed
1414
- `Option(3)` works now
1515
- The constructors `Const{ElementType}(value)` and `Identity{ElementType}(value)` had been removed already, however were still used. Maybe this now gave errors because of newer julia version, don't know, but now everything uses `Const(value)` and `Identity(value)` instead.
16+
- fixed a couple of disambiguation errors which magically appeared after switching to Julia 1.6
1617

1718
### Removed
1819
- `Option{T}(value::T)` didn't work and is removed now, as it does not provide any benefit anylonger, which is a breaking change

src/ContextManager.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ end
7575
# ContextManager is just a wrapper
7676
# pass through function call syntax
7777
(c::ContextManager)(cont) = c.f(cont)
78-
Base.run(cont, c::ContextManager) = c(cont)
78+
# in principle `cont` could be anything, as anything could be a function, however we have an ambiguity with Base AbstractCmd, and as this is mainly used for do-syntax
79+
# it should be fine to restrict to `Function`
80+
Base.run(cont::Function, c::ContextManager) = c(cont)
7981
Base.run(c::ContextManager) = c(identity)
8082

8183

src/Identity.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Base.eltype(::Type{<:Identity{T}}) where T = T
3636
Base.eltype(::Type{<:Identity}) = Any
3737

3838
Base.iterate(a::Identity) = a.value, nothing
39-
Base.iterate(a::Identity, state) = state
39+
Base.iterate(a::Identity, state::Nothing) = state
4040
Base.foreach(f, a::Identity) = begin f(a.value); nothing; end
4141
Base.map(f, a::Identity) = Identity(f(a.value))
4242
# for convenience, Identity does not use convert, whatever monad is returned is valid, providing maximum flexibility.

src/Try.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,9 @@ function Base.showerror(io::IO, ::MIME"text/plain", exc::MultipleExceptions)
8686
Base.show(io, MIME"text/plain"(), exc)
8787
end
8888

89-
Base.merge(f1::Thrown, f2::Thrown) = MultipleExceptions((f1, f2))
90-
Base.merge(f::Thrown, e::Exception) = MultipleExceptions((f, e))
91-
Base.merge(e::Exception, f::Thrown) = MultipleExceptions((e, f))
89+
Base.merge(e1::Exception, e2::Exception) = MultipleExceptions((e1, e2))
9290
Base.merge(es::MultipleExceptions, e::Exception) = MultipleExceptions(tuple(es.exceptions..., e))
93-
Base.merge(e::Exception, fs::MultipleExceptions) = MultipleExceptions(tuple(e, fs.exceptions...))
91+
Base.merge(e::Exception, es::MultipleExceptions) = MultipleExceptions(tuple(e, es.exceptions...))
9492
Base.merge(es1::MultipleExceptions, es2::MultipleExceptions) = MultipleExceptions(tuple(es1.exceptions..., es2.exceptions...))
9593

9694

src/promote_type.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,14 @@ end
101101
# we need to be cautious here, as we cannot dispatch on Type{<:Either{<:Any, R}} or similar, because R might not be defined
102102
Base.promote_rule(::Type{Either{L, R}}, ::Type{Either{L, R}}) where {L, R} = Either{L, R}
103103
Base.promote_rule(::Type{Either{L1, R}}, ::Type{Either{L2, R}}) where {L1, R, L2 <: L1} = Either{L1, R}
104+
Base.promote_rule(::Type{Either{L2, R}}, ::Type{Either{L1, R}}) where {L1, R, L2 <: L1} = Either{L1, R} # we needed to add this because rule A and B are ambiguous otherwise
104105
Base.promote_rule(::Type{Either{L, R1}}, ::Type{Either{L, R2}}) where {L, R1, R2 <: R1} = Either{L, R1}
105106
Base.promote_rule(::Type{Either{L1, R1}}, ::Type{Either{L2, R2}}) where {L1, R1, L2 <: L1, R2} = Either{L1, <:Any}
106-
Base.promote_rule(::Type{Either{L2, R1}}, ::Type{Either{L1, R2}}) where {L1, R1, L2, R2 <: R1} = Either{<:Any, R1}
107+
Base.promote_rule(::Type{Either{L1, R1}}, ::Type{Either{L2, R2}}) where {L1, R1, L2, R2 <: R1} = Either{<:Any, R1}
107108
Base.promote_rule(::Type{Either{L1, R1}}, ::Type{Either{L2, R2}}) where {L1, R1, L2 <: L1, R2 <: R1} = Either{L1, R1}
108-
Base.promote_rule(::Type{Either{L2, R1}}, ::Type{Either{L1, R2}}) where {L1, R1, L2 <: L1, R2 <: R1} = Either{L1, R1}
109+
Base.promote_rule(::Type{Either{L2, R1}}, ::Type{Either{L1, R2}}) where {L1, R1, L2 <: L1, R2 <: R1} = Either{L1, R1} # rule A
109110

110-
Base.promote_rule(::Type{Either{L1, R}}, ::Type{Either{L2, R}}) where {L1, R, L2} = Either{<:Any, R}
111+
Base.promote_rule(::Type{Either{L1, R}}, ::Type{Either{L2, R}}) where {L1, R, L2} = Either{<:Any, R} # rule B
111112
Base.promote_rule(::Type{Either{L, R1}}, ::Type{Either{L, R2}}) where {L, R1, R2} = Either{L, <:Any}
112113
Base.promote_rule(::Type{Either{L1, R1}}, ::Type{Either{L2, R2}}) where {L1, R1, L2, R2} = Either
113114

0 commit comments

Comments
 (0)