Skip to content

Commit 095dc51

Browse files
authored
Merge pull request #167 from JuliaDiff/ox/error_for_nonliterals
error for nonliterals
2 parents e804511 + 4df48b8 commit 095dc51

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/codegen/forward.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ function fwd_transform!(ci, mi, nargs, N)
5858
# version.
5959
return nothing
6060
else
61-
#TODO put guard here. We really don't want to generate invalid IR
62-
# by wrapping something that isn't more or less a literal in a ZeroBundle
61+
# Fallback case, for literals.
62+
# If it is an Expr, then it is not a literal
63+
if isa(stmt, Expr)
64+
error("Unexprected statement encountered. This is a bug in Diffractor. stmt=$stmt")
65+
end
6366
return Expr(:call, ZeroBundle{N}, stmt)
6467
end
6568
end

0 commit comments

Comments
 (0)