Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unused types warnings #82

Merged
merged 2 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/Interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function createbranch! end
error("Tree does not have an available destination node called " *
_getnodename(tree, dn))
sn ≢ dn || error("Branch must connect different nodes")

return ismissing(data) ?
_createbranch!(tree, sn, dn, len, name) :
_createbranch!(tree, sn, dn, len, name, data)
Expand All @@ -348,7 +348,7 @@ end
error("Tree does not have an available destination node called " *
_getnodename(tree, dst))
src ≢ dst || error("Branch must connect different nodes")

return ismissing(data) ?
_createbranch!(tree, src, dst, len, name) :
_createbranch!(tree, src, dst, len, name, data)
Expand All @@ -371,7 +371,7 @@ end
error("Tree does not have an available destination node called " *
_getnodename(tree, dn))
sn ≢ dn || error("Branch must connect different nodes")

return ismissing(data) ?
_createbranch!(tree, sn, dn, len, name) :
_createbranch!(tree, sn, dn, len, name, data)
Expand All @@ -392,7 +392,7 @@ end
error("Tree does not have an available destination node called " *
_getnodename(tree, dst))
src ≢ dst || error("Branch must connect different nodes")

return ismissing(data) ?
_createbranch!(tree, src, dst, len, name) :
_createbranch!(tree, src, dst, len, name, data)
Expand Down Expand Up @@ -644,7 +644,7 @@ function isleaf end
end
@traitfn function isleaf(tree::T, node::N) where
{T <: AbstractTree{OneTree}, N; MatchNodeType{T, N}}
_hasnode(tree, node) || error("Node $node does not exist")
_hasnode(tree, node) || error("Node $node does not exist")
return _isleaf(tree, node)
end

Expand Down Expand Up @@ -1036,12 +1036,12 @@ Return the length of this branch.
"""
function getlength end
@traitfn function getlength(tree::T, branch::B) where
{T <: AbstractTree{OneTree}, B, N; !MatchBranchType{T, B}}
{T <: AbstractTree{OneTree}, B; !MatchBranchType{T, B}}
hasbranch(tree, branch) || error("Branch $branch does not exist")
return _getlength(tree, _getbranch(tree, branch))
end
@traitfn function getlength(tree::T, branch::B) where
{T <: AbstractTree{OneTree}, B, N; MatchBranchType{T, B}}
{T <: AbstractTree{OneTree}, B; MatchBranchType{T, B}}
_hasbranch(tree, branch) || error("Branch $branch does not exist")
return _getlength(tree, branch)
end
Expand Down
4 changes: 2 additions & 2 deletions src/Tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ abstract type AbstractBranchTree{RT, N, B, LI, ND} <:
end

import Phylo.API: _hasinbound
function _hasinbound(tree::AbstractBranchTree{<: Rooted}, name::String)
function _hasinbound(tree::AbstractBranchTree{<: Rooted}, name::String)
return tree.nodes[name].inbound !== nothing
end

Expand Down Expand Up @@ -429,7 +429,7 @@ end

import Phylo.API: _addoutbound!
function _addoutbound!(tree::BinaryTree{RT}, name::String, branch::B) where
{RT <: Rooted, N, B <: Branch{RT, String}}
{RT <: Rooted, B <: Branch{RT, String}}
node = tree.nodes[name]
node.outbounds[1] ≡ nothing ?
node.outbounds = (branch, node.outbounds[2]) :
Expand Down
10 changes: 5 additions & 5 deletions src/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@

_handlez(x, tree, names) = x
_handlez(x::Union{String, Symbol}, tree, names) = [getnodedata(tree, name, x) for name in names]
function _handlez(x::Dict, tree, names) where T
function _handlez(x::Dict, tree, names)

Check warning on line 155 in src/plot.jl

View check run for this annotation

Codecov / codecov/patch

src/plot.jl#L155

Added line #L155 was not covered by tests
ret = fill(NaN, length(names))
for (i, n) in enumerate(names)
name = getnodename(tree, n)
Expand Down Expand Up @@ -293,10 +293,10 @@
"""
map_depthfirst(FUN, start, tree, eltype = nothing)

Apply `FUN` to each node in `tree` in depth-first order, and return the result.
`FUN` must take two arguments, `val` and `node`, where `val` is the result of
applying `FUN` to the previous node, and `node` is the current node. `start`
specifies the initial value of `val`, and `eltype` specifies the type of the
Apply `FUN` to each node in `tree` in depth-first order, and return the result.
`FUN` must take two arguments, `val` and `node`, where `val` is the result of
applying `FUN` to the previous node, and `node` is the current node. `start`
specifies the initial value of `val`, and `eltype` specifies the type of the
return value of `FUN`.

### Examples
Expand Down
2 changes: 1 addition & 1 deletion src/routes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function noderoute end
return [getnodename(tree, n) for n in route]
end
@traitfn function noderoute(tree::T, node1::N, node2::N) where
{RT, N, T <: AbstractTree{OneTree}; MatchNodeType{T, N}}
{N, T <: AbstractTree{OneTree}; MatchNodeType{T, N}}
branches1, nodes1 = _treehistory(tree, node1)
branches2, nodes2 = _treehistory(tree, node2)
nodes1[end] == nodes2[end] || error("No route between nodes in tree")
Expand Down
Loading