Skip to content

Commit 89b4d80

Browse files
committed
Add helpful error for naked produce call
1 parent 850523d commit 89b4d80

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/copyable_task.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ the current world age, will make a copy of an existing `MistyClosure`. If not,
7272
will derive it from scratch (derive the IR + compile it etc).
7373
"""
7474
function build_callable(sig::Type{<:Tuple})
75+
if sig <: Tuple{typeof(produce),Any}
76+
msg = """
77+
Can not construct a TapedTask for a 'naked' call to `produce`.
78+
Please wrap the call to `produce` in a function, and construct a
79+
TapedTask from that function."""
80+
throw(ArgumentError(msg))
81+
end
7582
key = CacheKey(Base.get_world_counter(), sig)
7683
if haskey(mc_cache, key)
7784
return fresh_copy(mc_cache[key])

0 commit comments

Comments
 (0)