1
+ const not_supported_exc = ArgumentError (" not supported" )
1
2
2
3
"""
3
4
ParentLinks(::Type{T})
@@ -42,6 +43,7 @@ the tree structure and cannot be inferred through a single node.
42
43
"""
43
44
struct ImplicitParents <: ParentLinks ; end
44
45
46
+ ParentLinks (:: Type{Union{}} ) = throw (not_supported_exc)
45
47
ParentLinks (:: Type ) = ImplicitParents ()
46
48
ParentLinks (tree) = ParentLinks (typeof (tree))
47
49
@@ -84,6 +86,7 @@ from the tree structure.
84
86
"""
85
87
struct ImplicitSiblings <: SiblingLinks ; end
86
88
89
+ SiblingLinks (:: Type{Union{}} ) = throw (not_supported_exc)
87
90
SiblingLinks (:: Type ) = ImplicitSiblings ()
88
91
SiblingLinks (tree) = SiblingLinks (typeof (tree))
89
92
@@ -126,6 +129,7 @@ class of indexable trees consisting of arrays.
126
129
"""
127
130
struct NonIndexedChildren <: ChildIndexing end
128
131
132
+ ChildIndexing (:: Type{Union{}} ) = throw (not_supported_exc)
129
133
ChildIndexing (:: Type ) = NonIndexedChildren ()
130
134
ChildIndexing (node) = ChildIndexing (typeof (node))
131
135
@@ -143,6 +147,7 @@ If the `childrentype` can be inferred from the type of the node alone, the type
143
147
**OPTIONAL**: In most cases, [`childtype`](@ref) is used instead. If `childtype` is not defined it will fall back
144
148
to `eltype ∘ childrentype`.
145
149
"""
150
+ childrentype (:: Type{Union{}} ) = throw (not_supported_exc)
146
151
childrentype (:: Type{T} ) where {T} = Base. _return_type (children, Tuple{T})
147
152
childrentype (node) = typeof (children (node))
148
153
@@ -159,6 +164,7 @@ If `childtype` can be inferred from the type of the node alone, the type `::Type
159
164
can be type-stable. If `childrentype` is defined and can be known from the node type alone, this function will
160
165
fall back to `eltype(childrentype(T))`. If this gives a correct result it's not necessary to define `childtype`.
161
166
"""
167
+ childtype (:: Type{Union{}} ) = throw (not_supported_exc)
162
168
childtype (:: Type{T} ) where {T} = eltype (childrentype (T))
163
169
childtype (node) = eltype (childrentype (node))
164
170
@@ -172,6 +178,7 @@ traversal is type stable.
172
178
173
179
**OPTIONAL**: Type inference is used to attempt to
174
180
"""
181
+ childstatetype (:: Type{Union{}} ) = throw (not_supported_exc)
175
182
childstatetype (:: Type{T} ) where {T} = Iterators. approx_iter_type (childrentype (T))
176
183
childstatetype (node) = childstatetype (typeof (node))
177
184
@@ -204,6 +211,7 @@ type.
204
211
"""
205
212
struct NodeTypeUnknown <: NodeType end
206
213
214
+ NodeType (:: Type{Union{}} ) = throw (not_supported_exc)
207
215
NodeType (:: Type ) = NodeTypeUnknown ()
208
216
NodeType (node) = NodeType (typeof (node))
209
217
@@ -214,5 +222,6 @@ NodeType(node) = NodeType(typeof(node))
214
222
Returns a type which must be a parent type of all nodes in the tree connected to `node`. This can be used to,
215
223
for example, specify the `eltype` of any `TreeIterator` on `node`.
216
224
"""
225
+ nodetype (:: Type{Union{}} ) = throw (not_supported_exc)
217
226
nodetype (:: Type ) = Any
218
227
nodetype (node) = nodetype (typeof (node))
0 commit comments