Skip to content

Commit 96c351e

Browse files
authored
Don't disallow Bottom returns. (#510)
Although we inferred some kind of error, it's likely that deferring validation will yield better error messages.
1 parent ed908ee commit 96c351e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/validation.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ function check_method(@nospecialize(job::CompilerJob))
3232
if job.config.kernel
3333
rt = typeinf_type(job.source; interp=get_interpreter(job))
3434

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

0 commit comments

Comments
 (0)