Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mauro-milella committed Nov 4, 2023
1 parent 2a27f4c commit 1f1b4e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/propositional-logic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,9 @@ struct TruthDict{
T<:Truth,
D<:AbstractDict{<:Atom{<:A},T},
}
truthtype = supertype(T)
truthtype = supertype(T) <: Truth ? supertype(T) : Truth
d = Dict{Atom{A},truthtype}(d)

return new{A,truthtype,typeof(d)}(d)
end
function TruthDict{A,T}(d::AbstractDict{<:Atom,T}) where {A,T<:Truth}
Expand Down Expand Up @@ -496,7 +497,6 @@ end

############################################################################################

# NOTE: the following has to be discussed @mauro-milella
"""
struct TruthTable{A,T<:Truth}
Expand Down
3 changes: 2 additions & 1 deletion test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ f_conj_int = @test_nowarn CONJUNCTION(f_int, f_int, f_int)

@test_nowarn TruthDict()
@test_nowarn TruthDict([])
@test_nowarn TruthDict((2,3),)
@test_throws MethodError TruthDict((2,3),)
@test_nowarn TruthDict((2,true),)
@test_nowarn TruthDict((p1, true),)
@test_nowarn TruthDict([(p1, true),])
@test_nowarn TruthDict(p1 => true)
Expand Down

0 comments on commit 1f1b4e1

Please sign in to comment.