1+ const not_supported_exc = ArgumentError (" not supported" )
12
23"""
34 ParentLinks(::Type{T})
@@ -42,6 +43,7 @@ the tree structure and cannot be inferred through a single node.
4243"""
4344struct ImplicitParents <: ParentLinks ; end
4445
46+ ParentLinks (:: Type{Union{}} ) = throw (not_supported_exc)
4547ParentLinks (:: Type ) = ImplicitParents ()
4648ParentLinks (tree) = ParentLinks (typeof (tree))
4749
@@ -84,6 +86,7 @@ from the tree structure.
8486"""
8587struct ImplicitSiblings <: SiblingLinks ; end
8688
89+ SiblingLinks (:: Type{Union{}} ) = throw (not_supported_exc)
8790SiblingLinks (:: Type ) = ImplicitSiblings ()
8891SiblingLinks (tree) = SiblingLinks (typeof (tree))
8992
@@ -126,6 +129,7 @@ class of indexable trees consisting of arrays.
126129"""
127130struct NonIndexedChildren <: ChildIndexing end
128131
132+ ChildIndexing (:: Type{Union{}} ) = throw (not_supported_exc)
129133ChildIndexing (:: Type ) = NonIndexedChildren ()
130134ChildIndexing (node) = ChildIndexing (typeof (node))
131135
@@ -143,6 +147,7 @@ If the `childrentype` can be inferred from the type of the node alone, the type
143147**OPTIONAL**: In most cases, [`childtype`](@ref) is used instead. If `childtype` is not defined it will fall back
144148to `eltype ∘ childrentype`.
145149"""
150+ childrentype (:: Type{Union{}} ) = throw (not_supported_exc)
146151childrentype (:: Type{T} ) where {T} = Base. _return_type (children, Tuple{T})
147152childrentype (node) = typeof (children (node))
148153
@@ -159,6 +164,7 @@ If `childtype` can be inferred from the type of the node alone, the type `::Type
159164can be type-stable. If `childrentype` is defined and can be known from the node type alone, this function will
160165fall back to `eltype(childrentype(T))`. If this gives a correct result it's not necessary to define `childtype`.
161166"""
167+ childtype (:: Type{Union{}} ) = throw (not_supported_exc)
162168childtype (:: Type{T} ) where {T} = eltype (childrentype (T))
163169childtype (node) = eltype (childrentype (node))
164170
@@ -172,6 +178,7 @@ traversal is type stable.
172178
173179**OPTIONAL**: Type inference is used to attempt to
174180"""
181+ childstatetype (:: Type{Union{}} ) = throw (not_supported_exc)
175182childstatetype (:: Type{T} ) where {T} = Iterators. approx_iter_type (childrentype (T))
176183childstatetype (node) = childstatetype (typeof (node))
177184
@@ -204,6 +211,7 @@ type.
204211"""
205212struct NodeTypeUnknown <: NodeType end
206213
214+ NodeType (:: Type{Union{}} ) = throw (not_supported_exc)
207215NodeType (:: Type ) = NodeTypeUnknown ()
208216NodeType (node) = NodeType (typeof (node))
209217
@@ -214,5 +222,6 @@ NodeType(node) = NodeType(typeof(node))
214222Returns a type which must be a parent type of all nodes in the tree connected to `node`. This can be used to,
215223for example, specify the `eltype` of any `TreeIterator` on `node`.
216224"""
225+ nodetype (:: Type{Union{}} ) = throw (not_supported_exc)
217226nodetype (:: Type ) = Any
218227nodetype (node) = nodetype (typeof (node))
0 commit comments