Skip to content

Commit

Permalink
Fix error exception (#1931)
Browse files Browse the repository at this point in the history
* Fix error exception

* fix

---------

Co-authored-by: William Moses <[email protected]>
  • Loading branch information
wsmoses and William Moses authored Sep 30, 2024
1 parent d97bb83 commit 66ef0f3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Enzyme.jl
Original file line number Diff line number Diff line change
Expand Up @@ -682,15 +682,19 @@ code, as well as high-order differentiation.

if A isa UnionAll
rt = Compiler.primal_return_type(rmode, Val(world), FTy, tt)
A2 = A{rt}
rt = Core.Compiler.return_type(f.val, tt)
A2 = A{rt}
if rt == Union{}
throw(ErrorException("Return type inferred to be Union{}. Giving up."))
end
else
@assert A isa DataType
rt = A
if rt == Union{}
throw(ErrorException("Return type inferred to be Union{}. Giving up."))
end
end

if rt == Union{}
error("Return type inferred to be Union{}. Giving up.")
end

ModifiedBetweenT = falses_from_args(Nargs + 1)
ModifiedBetween = Val(ModifiedBetweenT)
Expand Down

0 comments on commit 66ef0f3

Please sign in to comment.