Skip to content

Commit e54ec7f

Browse files
authored
remove no-op UB from FunctionConstructor
1 parent 72bb19d commit e54ec7f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/functions.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ _isgensym(s::Symbol) = occursin("#", string(s))
88
@generated function (fc::FunctionConstructor{F})(args...) where F
99
isempty(args) && return Expr(:new, F)
1010

11-
T = getfield(parentmodule(F), nameof(F))
1211
# We assume all gensym names are anonymous functions
13-
_isgensym(nameof(F)) || return :($T(args...))
12+
_isgensym(nameof(F)) || return :($F(args...))
1413
# Define `new` for rebuilt function type that matches args
15-
exp = Expr(:new, Expr(:curly, T, args...))
14+
exp = Expr(:new, Expr(:curly, F, args...))
1615
for i in 1:length(args)
1716
push!(exp.args, :(args[$i]))
1817
end

0 commit comments

Comments
 (0)