Skip to content

Commit

Permalink
Merge pull request #82 from cossio/type_warn
Browse files Browse the repository at this point in the history
Fix unused types warnings
  • Loading branch information
richardreeve authored Jul 6, 2023
2 parents 66d9275 + 98e23bf commit 6645deb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
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 @@ end

_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)
ret = fill(NaN, length(names))
for (i, n) in enumerate(names)
name = getnodename(tree, n)
Expand Down Expand Up @@ -293,10 +293,10 @@ end
"""
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

0 comments on commit 6645deb

Please sign in to comment.