Skip to content

Commit

Permalink
Don't disallow Bottom returns. (#510)
Browse files Browse the repository at this point in the history
Although we inferred some kind of error, it's likely that deferring
validation will yield better error messages.
  • Loading branch information
maleadt authored Sep 12, 2023
1 parent ed908ee commit 96c351e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/validation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ function check_method(@nospecialize(job::CompilerJob))
if job.config.kernel
rt = typeinf_type(job.source; interp=get_interpreter(job))

if rt != Nothing
if rt != Nothing && rt != Union{}
throw(KernelError(job, "kernel returns a value of type `$rt`",
"""Make sure your kernel function ends in `return`, `return nothing` or `nothing`.
If the returned value is of type `Union{}`, your Julia code probably throws an exception.
Inspect the code with `@device_code_warntype` for more details."""))
"""Make sure your kernel function ends in `return`, `return nothing` or `nothing`."""))
end
end

Expand Down

0 comments on commit 96c351e

Please sign in to comment.