Skip to content

Commit 55bca63

Browse files
committed
refactor: ensure validate_not_all_defaults is compiled
1 parent 74c8dc1 commit 55bca63

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/Node.jl

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,13 @@ include("base.jl")
218218
end
219219
return node_factory(N, T1, val, feature, op, l, r, allocator)
220220
end
221-
function validate_not_all_defaults(::Type{N}, val, feature, op, l, r, children) where {N<:AbstractExpressionNode}
222-
return nothing
223-
end
224-
function validate_not_all_defaults(::Type{N}, val, feature, op, l, r, children) where {T,N<:AbstractExpressionNode{T}}
225-
if val === nothing && feature === nothing && op === nothing && l === nothing && r === nothing && children === nothing
226-
error(
227-
"Encountered the call for $N() inside the generic constructor. "
228-
* "Did you forget to define `$(Base.typename(N).wrapper){T}() where {T} = new{T}()`?"
229-
)
230-
end
221+
validate_not_all_defaults(::Type{<:AbstractExpressionNode}, val, feature, op, l, r, children) = nothing
222+
validate_not_all_defaults(::Type{<:AbstractExpressionNode{T}}, val, feature, op, l, r, children) where {T} = nothing
223+
function validate_not_all_defaults(::Type{<:AbstractExpressionNode{T}}, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing) where {T}
224+
error(
225+
"Type setup error for $N(). "
226+
* "Did you forget to define `$(Base.typename(N).wrapper){T}() where {T} = new{T}()`?"
227+
)
231228
return nothing
232229
end
233230
"""Create a constant leaf."""

0 commit comments

Comments
 (0)